Tuesday, May 27, 2014

hide all tags having same class name using jquery

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

2) <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>

3) Selects all <p> elements with class="intro"

No comments:

Post a Comment