Call a function after leaving input field
You can use onblur()
or onfocusout()
. It will call function once you click out of that text field.
Example:
function myFunction() {
var x = document.getElementById("sometext");
x.value = x.value.toUpperCase();
}
<input type="text" id="sometext" onfocusout="myFunction()">
Note: As from React 16, onFocusIn and onFocusOut have been replaced by onFocus and onBlur respectively. Hence you now have:
<input type='text' name='input_email' onBlur={this.validateEmail}/>