JavaScript – Name Selector
A JavaScript selector can be used to target HTML elements by their name attribute.
A JavaScript selector can be used to target HTML elements by their name attribute.
A JavaScript selector can be used to target HTML elements by their tag name.
The Element getElementsByClassName() method returns a collection of child elements with a given class name.
The Element getElementsByClassName() method returns a collection of child elements with a given tag name.
The Element querySelector() method returns the first child element that matches the specified CSS selector or selectors of an element.
The Element querySelectorAll() method returns an element’s child elements, as a static NodeList object, that match specified CSS selectors.
jQuery has numerous built-in selectors that make it easy to access HTML elements.
The * selector selects all HTML elements in the document, and if used together with another element can be used to select all that element’s child elements.
The :animated selector selects all HTML elements that are currently animated.
The [attribute] selector selects every HTML element with the specified attribute.
The [attribute=value] selector selects every element with both the specified attribute and specified value.
The [attribute!=value] selector selects every element with the specific attribute that does NOT have the specified value.
The [attribute$=value] selector selects every element with a specific attribute that has a value ending in a specified string.
The [attribute|=value] selector selects every element with a specific attribute that has a value equal to or starting with a specified value.
The [attribute^=value] selector selects every element with a specific attribute that starts with a value beginning with a specified string.
The [attribute~=value] selector selects every element with a specific attribute that has a value containing a specified stand-alone word.
The [attribute*=value] selector selects every element with a specific attribute that has a value containing a specified string even as part of another word.
The :button selector selects HTML form input elements and button elements with type=”button”.
The :checkbox selector selects HTML form input elements with type=”checkbox”.
The :checked selector selects all checked HTML checkboxes or radio buttons.