Data Binding Examples

Directions

Open the browser's Console tab, and enter some of the examples.

There is a global object defined named obj which you can inspect or edit.

Bind to ... Bound Element Examples to Try at Console
input with type text
Age
obj.age = 42
div's content
Description
Bind div's content
obj.description = 'foo'
div element atteribute
Car's Color
Bind div's style
obj.carColor = 'background-color:red'
select element
State
obj.state = ['oh']
multi value select element
Countries Lived At (Select all)
obj.countries = ['fr', 'us']
input with type radio
Language
Arabic English French
obj.language = 'a'
input with type checkbox
Hobbies
Read Swim Travel
obj.hobbies = ['s', 'travel']
textarea
Pets
obj.pets = 'dog, cat'
onChange() unbounded property
Square Value
?
obj.squareMe = 2
onChange() bounded property
Twice Value
?
obj.twiceMe = 3