Created
September 11, 2011 12:28
-
-
Save j-5-s/1209516 to your computer and use it in GitHub Desktop.
how to use backbone and jquery validator together
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just can't understand why you're triggering
keyupon.errorclass. That doesn't make sense, at least for me.