New methods .blur and .focus
parent
aaa35a3412
commit
5464fc56d0
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue