Check Checkbox Disabled (Jquery)

你。 提交于 2019-12-05 00:50:12

You have to check whether the disabled attribute is true: .attr('disabled').

Or, better, use .is(':disabled').---


EDIT: So it seems that .attr is now deprecated for this use (see http://api.jquery.com/attr/) The preferred way is:

$('#myCheckbox').prop('disabled')

It has to be noted that this still work as of today:

$('#myCheckbox').is(':disabled')

Try it here: https://jsfiddle.net/Robloche/phaqfrmj/

Also you can try use this:

$("#myCheckBox").is('[disabled]');

Works for me to determine if an element is disabled, while others solutions (.disabled, .is(':disabled'), .attr('disabled'), .prop('disabled')) not.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!