Skip to content

Instantly share code, notes, and snippets.

View barrypitman's full-sized avatar

Barry Pitman barrypitman

  • Ubiquitech
  • South Africa
View GitHub Profile
@barrypitman
barrypitman / ie_button_fix.js
Created May 11, 2011 07:43 — forked from postpostmodern/ie_button_fix.js
Fixes <button> elements in IE <=7
// IE doesn't deal well with button elements.
// The following jQuery code fixes the two most common issues:
// 1. All button values being submitted whether they were clicked or not
// 2. Button labels being submitted instead of the value of the value attribute
// Make sure you have loaded jQuery, of course.
// Improvements:
// 1. Cleanly handles the case where a form submit handler prevents form submission (the buttons were left disabled previously)
// 2. Only applies fix to IE 7 and lower, as problem is fixed in IE8.