New methods .blur and .focus

old
Javi 2015-08-10 17:13:44 +07:00
parent aaa35a3412
commit 5464fc56d0
2 changed files with 25 additions and 3 deletions

View File

@ -88,11 +88,17 @@ module.exports = React.createClass
</div>
# -- Extends
blur: ->
@refs.input.blur?()
focus: ->
@refs.input.focus?()
getValue: ->
@refs.input?.getDOMNode()[if @state.touch then 'checked' else 'value']
setValue: (data) ->
@setState value: data
setError: (data = 'Unknown error') ->
@setState error: @props.error or data
setValue: (data) ->
@setState value: data

View File

@ -27,6 +27,22 @@ var Input = require('react-toolbox/components/input');
## Methods
#### focus
The focus event is sent to an element when it gains focus.
```
input_instance.focus();
```
#### blur
The blur event is sent to an element when it loses focus
```
input_instance.blur();
```
#### getValue
Returns the value of the input.