如何查看切换按钮的状态?
使用复选框,我可以监听复选框的“已更改”事件,并执行 $(this).is(":checked")
来查看它的状态。
<a id="myId" class="btn" data-toggle="button"/>
但不确定如何使用切换按钮来做到这一点?
最佳答案
你可以看到按钮有哪些类..
$(this).hasClass('disabled') // for disabled states
$(this).hasClass('active') // for active states
$(this).is(':disabled') // for disabled buttons only
is(':disabled')
适用于按钮,但不适用于链接 btns
关于jquery - Twitter Bootstrap : How to see the state of a toggle button?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13323671/