Skip to content

Instantly share code, notes, and snippets.

@actsasbuffoon
Created August 26, 2010 21:28
Show Gist options
  • Save actsasbuffoon/552300 to your computer and use it in GitHub Desktop.
Save actsasbuffoon/552300 to your computer and use it in GitHub Desktop.
$('input[type=submit]').each(function(i, eo) {
var btn, cls, elem, icon, text;
elem = $(eo);
text = elem.attr('value');
cls = elem.attr('class');
if (/icon_(.+)/i.test(cls)) {
icon = cls.replace(/^icon_/, '');
elem.after(("<a href='javascript:void(0)' class='button'><img alt='icon' class='icon' src='/images/icons/" + (icon) + ".png' />" + (text) + "</a>"));
btn = elem.next();
btn.click(function(b) {
return elem.click();
});
return elem.hide();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment