Thursday, November 20, 2014

Stop IE8 Form Submit on HTML Button on click using JQuery

Internet Explorer 8, and also in newer versions of IE that are running in compatibility mode, buttons in a form automatically do a form post.

If you are in Chrome, newer versions of Internet Explorer or really any other modern browser this will not be a problem.  But often I have clients that use old versions of browsers for various valid business needs.

To get around this problem I just capture the click event in jquery and return false. The HTML and JQuery example below shows a snippet on how to do this.


No comments:

Post a Comment