Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在函数中找到切换状态?该功能是否具有内置功能,它会告诉我,即 toggle=on 或 toggle=off
我想没有预定义的函数,但你必须使用它
var state = $(this).is(":hidden"); alert(state);
你的意思是检查元素是否可见?.toggle() 改变 css "display:none;" 到“显示:块;”。查看:
$('#element').attr('display') == 'none' ? state = 'on' : state = 'off';