jQuery .click()

jQuery .click() bind an event handler to the "click" JavaScript event, or trigger that event on an element;


    $('.target').click(function() { // bind an event handler to the click event
        $('.log').append(' click-event');
    $('.trigger').click(function() { // trigger the click event manually
        $('.log').append(' click-trigger');


<div class="well">
        <span class="target btn btn-primary">click me</span>
        <span class="trigger btn btn-inverse">click me to trigger click event manually</span>
    <div class="log alert alert-block">log</div>

Leave a Comment