$( "#other" ).click(function() {
$( "#target" ).click();
});
$( "p" ).on( "click", function() {
alert( $( this ).text() );
});
//1st way
$(".searchCategory").click(function () {
//your code here
});
//2nd way
$(".searchCategory").on( "click",getCategory); // getCategory is a function but don't need the pharenthesis
//if you write getCategory() instead of getCategory when getCategory is a function with no pharamenters it might not work
$( "#target" ).click(function() {
alert( "Handler for .click() called." );
});
$(document).on('click' , '.class' , function(){
//event
})
$("p").click(function(){
alert("The paragraph was clicked.");
});
$(document).on('click touch', '.your-element', function () { ... });
1
2
3
$( "#dataTable tbody" ).on( "click", "tr", function() {
console.log( $( this ).text() );
});
var myEl = document.getElementById('myelement');
myEl.addEventListener('click', function() {
alert('Hello world');
}, false);
myEl.addEventListener('click', function() {
alert('Hello world again!!!');
}, false);
$( "#other" ).click(function() {
$( "#target" ).click();
});