Coding

The .class Selector – jQuery Tutorial

Task

The .class Selector

Description

The jQuery class selector finds the elements with the specific class.
To find elements with the specific class, write the period character, followed by the name of the the class:

$(".test")

Example

In this example when user clicks on the button the elements with class=”test” will be hidden:

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

Try It Yourself - Online Compliler >>