$("p.intro") Selects all <p> elements with class="intro" - Javascript jQuery

Javascript examples for jQuery:Selector

Description

$("p.intro") Selects all <p> elements with class="intro"

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        $("p.intro").hide();
    });//from  www  . j av  a2  s. c  o m
});
</script>
</head>
<body>

<h2 class="intro">This is a heading</h2>

<p class="intro">This is a paragraph.</p>
<p>This is another paragraph.</p>

<button>Click me</button>

</body>
</html>

Related Tutorials