.click()
Attaches a click event handler to elements or triggers the click event if called with no arguments.
Syntax
jquery
$(selector).click(handler)
$(selector).click()Example
jquery
$(".btn").click(function() {
$(this).toggleClass("active");
});
// Trigger a click programmatically:
$("#submit").click();
// With event data:
$(".item").click({ index: 0 }, function(e) {
console.log(e.data.index);
});