开发者

how to find out if a checkbox is checked in jQuery

开发者 https://www.devze.com 2023-01-02 14:28 出处:网络
is there a simple way to find out if a checkbox is开发者_开发知识库 checked in jquery. something like .checked or ischeckedel.is(\':checked\')

is there a simple way to find out if a checkbox is开发者_开发知识库 checked in jquery.

something like .checked or ischecked


el.is(':checked')

That's the jQuery way. At its core, though, it's just a bit more parsing to get down to el[0].checked, using the raw DOM property, so take whichever you prefer. The DOM method is probably better for actually testing an element, whereas :checked is better for selecting it in the first place.

0

精彩评论

暂无评论...
验证码 换一张
取 消