i'm trying to get an input box to get auto-selected when the user clicks on it the code i'm using :
<input type="text" onclick="this.focus();this.select();" value="i like pie">
tried with the solution provided here
the problem is that the code works for FF, Opera, Internet Explorer 8/7 but not for IE 6... any ideas how to make it work for IE6 too ?
The code works for me too.
If you don't have JavaScript enabled in your browser, your code wouldn't work. Check if JavaScript is enabled.
I was having this problem in IE7, and tried wrapping it in a timeout, which worked...even a timeout of 0ms worked.
window.setTimeout(function(){
target.select();
}, 0);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.