Coding

jQuery Selectors – jQuery Tutorial

Task

The element Selector

Description

jQuery selectors allow to select and manipulate the HTML element(s).

jQuery selectors are used to “find” (or select) the HTML elements based on their id, name, classes, types, attributes, values of attributes and much more.
It is based on the existing CSS Selectors. In addition it has some own custom selectors.
All the selectors in jQuery start with the dollar sign and parentheses: $().

The jQuery element selector selects elements based on the element name.

You can select all < p > elements on a page like this:

$("p")

Example

<script>
$(document).ready(function(){
    $("button").click(function(){
        $("p").hide();
    });
});
</script>

Try It Yourself - Online Compliler >>