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).
精彩评论