Created
April 13, 2012 11:17
-
-
Save nilcolor/2376008 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: (event) -> | |
field = $ event.currentTarget | |
value = $("option:selected", field).val() | |
data = {} | |
data[field.attr 'id'] = value | |
this.model.set data | |
fieldChanged: (event) -> | |
field = $ event.currentTarget | |
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