Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery - How to trigger $('#myForm').submit(function()

how can i trigger this function without using the form submit?

$('#myForm').submit(function()
{ ....
like image 582
Peter Avatar asked Sep 06 '11 08:09

Peter


People also ask

What does trigger do in jQuery?

The trigger() method triggers the specified event and the default behavior of an event (like form submission) for the selected elements. This method is similar to the triggerHandler() method, except that triggerHandler() does not trigger the default behavior of the event.

What is trigger (' click ')?

Use Google Tag Manager's click trigger to fire tags based on click events. When an element is clicked on a page that matches the trigger conditions, Tag Manager will automatically populate values for any active click-based built-in variables.

How do you trigger a click button?

and a trigger to execute the button1 click event handler. $("#button2"). bind("click", (function () { alert("Button 2 is clicked!"); $("#button1").

How can add trigger click event in jQuery?

If you are trying to trigger an event on the anchor, then the code you have will work I recreated your example in jsfiddle with an added eventHandler so you can see that it works: $(document). on("click", "a", function(){ $(this). text("It works!"); }); $(document).


1 Answers

You could try -

$('#myForm').trigger('submit');

Working demo - http://jsfiddle.net/ipr101/KvwMb/1/

like image 132
ipr101 Avatar answered Oct 16 '22 19:10

ipr101