javascript - Backbone.js - Remove standard submit event -


i handle submit event of form so:

 events: {     'submit #contactus-form': 'submit'  },  ...  submit: function() {    alert("handle");  }, 

but though after seeing alert page refreshes , adds url:

?name=&email=&text= 

how prevent standard behavior? leaving handler.

this because submiting can use event.preventdefault prevent this. try code:-

submit: function(e) {    e.preventdefault();    alert("handle"); }, 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -