Friday, February 23, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  10] [ 3]  / answers: 1 / hits: 18968  / 13 Years ago, fri, june 24, 2011, 12:00:00

I'm trying to select the text in a readonly input box, using jQuery, this is what I have:



    $('input').focus(function(){
$(this).select();
})


When I click on the input however, it quickly selects all the text, it blinks, then it goes back to normal state of being unselected.



Any ideas around this?


More From » jquery

 Answers
6

The problem is with the fact that the input box is readonly (as you mention in you question).

(it is not a jQuery or javascript problem)



IE, FF and Opera have no problem. But Chrome and Safari exhibit the issue you mention..



Looks like a different implementation, and i am not sure you can work-around that..



demo to showcase (check in all browsers with console open)

http://jsfiddle.net/gaby/N9qzq/3/


[#91513] Thursday, June 23, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
maxinec

Total Points: 117
Total Questions: 116
Total Answers: 116

Location: Bangladesh
Member since Sat, Jan 23, 2021
3 Years ago
maxinec questions
;