For example: http://codepen.io/Enclave88/pen/YqNpog?editors=1010
var InputBox = React.createClass({
render: function() {
return (
<input className="mainInput" value='Some something'></input>
)
}
});
For example: http://codepen.io/Enclave88/pen/YqNpog?editors=1010
var InputBox = React.createClass({
render: function() {
return (
<input className="mainInput" value='Some something'></input>
)
}
});
In my case I wanted to select the text from the beginning after the input appeared in the modal:
You have to set ref on the input and when focused you have to use select().
Auto select all content in a input for a react class. The onFocus attribute on a input tag will call a function. OnFocus function has a parameter called event generated automatically. Like show above event.target.select() will set all the content of a input tag.
Thanks, I appreciate it. I did it so:
Class component
:Functional component
:React.createClass
: