DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • can-value
  • / On this page
    • can-value

      function

      Sets up two way bindings in a template.

      • source

      Deprecated 2.3

      Use two way binding like {($value)}="KEY" instead.

      can-value='KEY'

      Binds the element's value or checked property to the value specified by key. Example:

      <input type='text' can-value='first.name'/>
      

      Parameters

      1. key {can-mustache.key}:

        A named value in the current scope.

      Use

      Add a can-value="KEY" attribute to an input or select element and the element's value will be cross-bound to an observable value specified by KEY.

      Depending on the element and the element's type, can-value takes on different behaviors. If an input element has a type not listed here, the behavior is the same as the text type.

      input type=text

      Cross binds the input's string text value with the observable value.

      The value of the observable is changed after the input's change event, which is after blur.

      input type=checkbox

      Cross binds the checked property to a true or false value. An alternative true and false value can be specified by setting can-true-value and can-false-value attributes.

      input type='radio'

      If the radio element is checked, sets the observable specified by can-value to match the value of value attribute.

      select

      Cross binds the selected option value with an observable value.

      textarea

      Cross binds the textarea's string text value with the observable value.

      The value of the observable is changed after the textarea's change event, which is after blur.

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.