// Examples: // // HTML: //
// // Rails: // button_to "Mark as unread", mark_as_unread_message_path(message), :method => :put, :class => "button_to_link" // // jQuery: // $(document).ready(function() { // $('.button_to_link').button_to_link() // }); // jQuery.fn.button_to_link = function() { // return the jQuery object for chaining return this.each(function(button){ var form = button.parents('form'); form.after('' + button.attr('value') + ''); form.hide(); form.next('a.button_link_to').click(function(){ form.submit(); return false; }); }) }); // Or you could just use a button and style it.