From 858955bc144f4de3a3b6bdfde6f381a96efea017 Mon Sep 17 00:00:00 2001 From: sebastien_andreu Date: Thu, 11 Dec 2014 01:31:41 +0000 Subject: [PATCH] Add focus method on Input fields --- src/js/input.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/input.jsx b/src/js/input.jsx index fc59b21615820e..564fd64480490e 100644 --- a/src/js/input.jsx +++ b/src/js/input.jsx @@ -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; @@ -98,7 +102,7 @@ var Input = React.createClass({ }, _onPlaceholderClick: function(e) { - this.refs.input.getDOMNode().focus(); + this.focus(); }, _onTextAreaChange: function(e) {