This question has a bit of background. See two other questions I recently posted that relate to:
How to select text in a cross browser with a text box
Endless loops created in Google Chrome
A word of warning: it is possible that the second link is a red herring.
Ok, so the problem is that I try to do this, when the user first clicks or enters tabs in the text box, all texts should be selected. If the text field has focus, subsequent clicks on the text inside the text field should behave normally (i.e. Do not iterate over the entire text). The answer that I choose in the first link above is the one I found in all browsers. The code below is for your convenience:
$('input[type="text"]').live('focus', function (event) { var inp = this; setTimeout(function () { inp.select(); }, 1); event.stopPropagation(); event.preventDefault(); return false; });
Now my second link above is what I seem to be working with with this approach. With interruptions, it seems Google Chrome is stuck somewhere and begins to very quickly change focus between text fields. You can see what I think is happening here: http://jsfiddle.net/ajbeaven/XppG9/14/
As I said, this is an intermittent problem, so you may need to reload the page several times to see what, in my opinion, can cause a change in focus. Remember that this only happens in chrome.
Thanks to everyone who can shed light!
source share