View RSS Feed

Recent Blogs Posts

  1. Preventing Form Submit with button element in Firefox

    by on March 11th, 2009 at 10:17 AM
    I had an issue in Firefox where I wanted a <button> element to fire a Javascript function onclick.

    However, I found in Firefox that the button also performed a submit on the form, which I didn't want.

    After a little investigation I discovered that the default type for a button element is submit. Apparently a bug in IE prevents it from firing.

    So, how to fix?

    Add a type="button" property to your <button> element
    ...

    Updated March 11th, 2009 at 10:19 AM by richyrich

    Categories
    Programming & Scripting , HTML/XHTML , Web Design , JavaScript

SEO by vBSEO