jQuery > Events

Trigger event in jQuery

How to trigger an event of a html element in jQuery?


To trigger an event of an element, trigger() method can be used.

<script>
        $("#divTrigger").click(function () {
            $("form").trigger('submit');
        });
    </script>

In the above code when “divTrigger” is clicked then form “submit” event triggers (the behavior will be same as if the form is being submitted).

 Views: 862 | Post Order: 87



Write for us