Jquery Selector

                                                 


It is used to select Html element from web pages

1) ID Selector

2)  Class Selector

3) Tag Selector


<button id="btn" >One</button>

<button class="abc">Two</button>

<button>Three</button>

$("#btn").click(function(){});

$(".abc").click(function(){});

$("button").click(function(){});



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

$(document).ready(function(){
   
   $("#btn").click(function(){alert("one")});
   $(".abc").click(function(){alert("two")});
   $("button").click(function(){alert("three")});

})


</script>
</head>
<body>

<button id="btn" >One</button>

<button class="abc">Two</button>

<button>Three</button>


</body>
</html>



Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post