Select all input value in input type number
I have this on a webpage. When the user clicks on an input element, I want the value of the input elements to be automatically selected.
I can do this by making an onclick event this.select () like below
<input type="number" onclick="this.select();" >
This will pick the value in firefox, chrome and IE. but it won't be on safari. i want to make it fit for iPhones too. hard google search I found a javascript method that safari supports that looks something like this.
document.getElementById(inputElementsId).setSelectionRange(0, 9999);
But it does not support the "number" input type. So, is there any other way to achieve this?
As always, thanks for your time.
+3
source to share