1$( "#target" ).click(function() {
2 alert( "Handler for .click() called." );
3});
1$(document).on("click", ".onClass", function () {
2 //your code
3 var element = $(this); // to get clicked element
4});
1<script>
2$(document).ready(function(){
3 $("#btn-txt").click(function(){
4 var ptext = $("#my-para").text();
5 alert(ptext);
6 });
7});
8</script>
9<button type="button" id="btn-txt">Get Text Content</button>
10<p id="my-para">This is a paragraph to Show jQuery text method.</p>
11
1$("#button").click(function () {
2 //result show on console.
3 console.log("Button Was Click");
4 //console.log(this);
5});