Sunday, 26 March 2017

JQuery Element Selectors

  • The Element Selectors selects all elements with the specific element name in html. 

ex:

$("element") 

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>

$(document).ready(function()
{
    $("p").css("background-color", "red");
});
</script>
  </head>
      <body>
       <h1>Home</h1>
        <p class="intro">introduction </p>
        <p>I live in Mumbai.</p>
        <p>india is best country in the world.</p>

    Who is your favorite:
         <ul id="choose">
             <li>facebook</li>
             <li>whatapp</li>
             <li>twitter</li>
         </ul>
    </body>
</html>

OUTPUT:

No comments:

Post a Comment

Thank you for comment