How to select all text of a text box in Safari browser?

I want to select all the text in a text box, and the custom focus in that text box at this time will automatically select its text. Same as .select () javascript function works in firefox or ie. Same functionality as Safari Safari browser.

+3


source to share


1 answer


See this answer :



// t is the input field
setTimeout(function() {
    t.setSelectionRange(0, 9999);
}, 1);

      

0


source







All Articles