Skip to content

Commit

Permalink
Merge pull request #139 from Sandreu/focus
Browse files Browse the repository at this point in the history
Add focus method on Input components
  • Loading branch information
Hai Nguyen committed Dec 11, 2014
2 parents 425b6c4 + 858955b commit 8f5e8cc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/js/input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ var Input = React.createClass({
clearValue: function() {
this.setValue("");
},

focus: function () {
if(this.isMounted()) this.refs.input.getDOMNode().focus();
},

_onInputChange: function(e) {
var value = e.target.value;
Expand All @@ -98,7 +102,7 @@ var Input = React.createClass({
},

_onPlaceholderClick: function(e) {
this.refs.input.getDOMNode().focus();
this.focus();
},

_onTextAreaChange: function(e) {
Expand Down

0 comments on commit 8f5e8cc

Please sign in to comment.