Element Selectors Example in JQuery


jQuery selectors allow you to select and manipulate HTML element(s). jQuery selectors are used to "find" (or select) HTML elements based on their name, id, classes, types, attributes, values of attributes and much more.

Source Code

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Element Selector Example</title>
    <!--------META-------->
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <!------JQUERY CDN---->
    <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  </head>
  <body>
    <h3>Element Selector Example</h3>
    <p>This para will be hide</p>
    <button type="button">Click Me</button>
    
    <button type="button" id="showBtn">Click Me 2</button>
    <script>
      $(document).ready(function(){
      	$("button").click(function()
      	{
      	  $("p").hide();
      	});
      });
      
      $(document).ready(function()
      {
      	$("#showBtn").click(function()
      	{
      	  $("p").show();
      	});
      });
    	
    </script>
  </body>
</html>
To download raw file Click Here

Learn All in Tamil © Designed & Developed By Tutor Joes