Element selector, click on a button, all paragraph Tags will be hidden

 <!DOCTYPE html>

<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
    $(document).ready(function () {
        $("button").click(function () {
            $("p").hide();
        });
    });
</script>

<body>
    <h2>This is a heading</h2>
    <p>This is a paragraph</p>
    <p>This is another paragraph</p>
    <button>Click me to hide paragraph</button>
</body>

</html>

Comments

Popular posts from this blog

Basic Syntax in jQuery

Event "Target" Property in jQuery