Skip to content

Instantly share code, notes, and snippets.

@j-5-s
Created September 11, 2011 12:28
Show Gist options
  • Save j-5-s/1209516 to your computer and use it in GitHub Desktop.
Save j-5-s/1209516 to your computer and use it in GitHub Desktop.
how to use backbone and jquery validator together
var someView = Backbone.View.extend({
initialize: function(options) {
},
events: {
'keyup .error': 'validateField'
},
validateField: function(e){
$(e.currentTarget).valid();
},
render: function(){
//..all your adding to the view here
this.setValidator();
return this
},
setValidator: function(){
$("#your-form",this.el).validate()
}
});
@chiefGui
Copy link

chiefGui commented Feb 4, 2014

I just can't understand why you're triggering keyup on .error class. That doesn't make sense, at least for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment