HTML5 App with MVVM and Knockout Study(2)

Study (2) Built In Bindings

  • Binding - Text and HTML

TEXT renders the text itself, while HTML renders with html syntax:

image

 run the code in jsFiddle

 

  • Binding - Checkbox and Radio Button
  1. For Radio buttons, only if the value attribute equals to the data binding parameter “checked”, KO will set the radio button to be checked, so the parameter value should be a string.
  2. For Checkboxes, KO will set the element to be checked when the parameter value is true, and unchecked when it is false.

Read this document for details

 

image

run the code in jsFiddle

  • Binding - List(single and multiple)

image

run the code in jsFiddle

  • Binding - enable/disable

 image

 run the code in jsFiddle

  • Binding - Focus/visible

 

image

 run this in jsFiddle

  • Binding - click and event

 

image

 run the code in jsFiddle

  • Binding - CSS and Styling

image

 run the code in jsFiddle

  • Binding – Attribute

image

run the code in jsFiddle

posted @ 2012-10-06 04:36  Jian, Li  Views(241)  Comments(0)    收藏  举报