react-input-mask
react-input-mask copied to clipboard
How set focus on InputMask element?
Could you show me an example how to set focus on masked input text? I treid autoFocus={true} but it doesn't work
For me it worked simply by adding autoFocus directly to the <inputMask />, but you can also test it this way: this.inputRef.getInputDOMNode().focus();.
Credits by @duhwcarvalho
This is documented: https://github.com/sanniassin/react-input-mask/tree/v2#inputref--function
I got solution by using javascript html passing id and try { window.document.getElementById("expiryDtId").focus(); } catch (error) { console.error(error); } works for me