Create Button which does not Submit – Ruby on Rails

Just another quick post – how to create a button which does not submit a form when it’s clicked:

<%= submit_tag 'My Button',  :type => 'button', :onclick => 'alert('Button not Submitted - Hopefully!!!!'), :class => "my_class" %>

Let me know if you have any problems.

Leave a Reply