Files
The Coding Aviator 48312b3ff9 fix(guide): Fix language names in jQuery section of guide (#35271)
* Fix language names

* Fix language name

* Update index.md

* Fix language names

* Change javascript to js
2019-03-01 12:33:52 -08:00

734 B

title
title
Target HTML Elements with Selectors Using jQuery
  • jQuery selectors allow you to select and manipulate HTML elements.
  • These selectors start with the dollar sign and parentheses: $()
  • You can "find" (or select) HTML elements based on their name, id, classes, types, attributes, values of attributes and much more.

Example

//You can select all <p> elements on a page like this  =  $("p")
  $(document).ready(function(){
    $("button").click(function(){
        $("p").hide();
    });
});

Solution

<script>
  $(document).ready(function() {
      $("button").addClass("animated bounce"); // We are selecting the button elements and adding "animated bounce" class to them.
  });
</script>