1$( "#target" ).click(function() {
2 alert( "Handler for .click() called." );
3});
1$( "#dataTable tbody tr" ).on( "click", function() {
2 console.log( $( this ).text() );
3});
4
1//1st way
2$(".searchCategory").click(function () {
3 //your code here
4});
5
6//2nd way
7$(".searchCategory").on( "click",getCategory); // getCategory is a function but don't need the pharenthesis
8//if you write getCategory() instead of getCategory when getCategory is a function with no pharamenters it might not work
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