Created
April 13, 2012 11:14
-
-
Save nilcolor/2375977 to your computer and use it in GitHub Desktop.
"Быстрый" датабиндинг для Backbone.js
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
events: { | |
"change input": "fieldChanged", | |
"change select": "selectionChanged", | |
}, | |
selectionChanged: function(e){ | |
var field = $(e.currentTarget); | |
var value = $("option:selected", field).val(); | |
var data = {}; | |
data[field.attr('id')] = value; | |
this.model.set(data); | |
}, | |
fieldChanged: function(e){ | |
var field = $(e.currentTarget); | |
var data = {}; | |
data[field.attr('id')] = field.val(); | |
this.model.set(data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment