Wednesday 29 March 2017

JQuery class Selectors

Class Selectors

  • class selector finds elements with a specific class.
  • period character use to find specific class.
  • In one page multiple controls or element have same class then select select all the element corresponding to that class.
Ex:  $(".cssclass")


<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        $(".cssclass").hide();
    });
});
</script>
</head>
<body>

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

<button>Click me</button>
</body>
</html>

No comments:

Post a Comment

Thank you for comment