开发者

Is this JQuery valid?

Is this JQuery valid? $("[name=enableTooltip]:checked")

What does it does开发者_如何转开发?


This is more understandable:

$("input[name=enableTooltip]:checked") 

This selects all inputs which has name attribute equals "enableTooltip" and checked status is true.

Example match:

<input type="checkbox" name="enableTooltip" checked="checked" />


The selector [attr=val] is a shortcut for *[attr=val]. So [name=enableTooltip]:checked will select any element that’s name attribute value is “enableTooltip” and is checked (:checked this implies that the element is an INPUT element of the type checkbox).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜