jquery onclick function

JavaScript
$( "#target" ).click(function() {
  alert( "Handler for .click() called." );
});$('#selector').on('click',function(){
    //Your code here
});                   $('h1').click(function () {
        $(this).css('color', 'blue')
    });$( "#other" ).click(function() {
  $( "#target" ).click();
});
//Click for event to trigger

$( "#target" ).click(function() {
  alert( "Handler for .click() called." );
});$(elem).click(myFunc());
Source

Also in JavaScript: