'Fire Button click event during onsubmit

I want to fire a click event during the onsubmit of form. In button click event I used a url which it has to redirect. I don't want to use the form's 'action" to redirect the page.

Can anyone help me in this?



Solution 1:[1]

Add an onsubmit event handler to your form element as follows:

form onsubmit='javascript:window.location.href="http://google.com"; return false;' 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user1342621