Selecting Elements by Form Status

$("input:checked");   //selects <input> elements that are checked $("option:selected");   //selects <option> elements that are selected $("#myForm :focus");   //selects the element in the #myForm <form>   //that currently has the focus $("input:disabled");   //selects <input> elements that are currently disabled

An extremely useful set of selectors when working with dynamic HTML forms is the form jQuery selectors. These selectors allow you to select elements in the form based on the state of the form element. Table 4.5 shows some examples of form selectors.

Image

Table 4.5 Examples ...

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.