I’ve starting using the Wijmo toolkit, and came across quite a few example selectors similar to this in their documentation pages:
$(":input[type='radio']").wijradio();
I’d have written mine like this:
$('input[type=radio]').wijradio();
Do these do the same or is there something I’m missing?
Note that there are two differences above: the first selector is prefixed with a colon and has quotes for the input type.
:inputis a jQuery extension whileinputis a CSS selector.textarea,button, andselectelements would be matched by the former, but not the latter.The latter is faster, so use it for your specific
radioexample. Use:inputwhen you want “all form elements” even if they aren’t strictly<input>tags. Even in that case, the recommendation is to use a standard CSS selector first, then use.filter(':input')on that set.In the 1.7.2 source, the :input filter tests a regular expression against the nodeName: