Skip to content

Instantly share code, notes, and snippets.

@actsasbuffoon
Created August 26, 2010 21:20
Show Gist options
  • Save actsasbuffoon/552281 to your computer and use it in GitHub Desktop.
Save actsasbuffoon/552281 to your computer and use it in GitHub Desktop.
$('input[type=submit]').each (i, eo) ->
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 (b) ->
elem.click()
elem.hide()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment