Rails - How to use onsubmit with form_tag
3 answers
Better put the function foo(); to the unobtrusive pipeline in Rails:
#app/assets/javascripts/application.js var foo = function(e) { e.preventDefault(); ... }; $(document).on("submit", "#form", foo(e)); You can accompany this with ...
<%= form_tag "#", id: "form" do %> +3