I perform the following functions:
- user clicks on or tabs in text box
- all text in the text box is selected if the text box no longer has focus, in which case the default click / select function should be performed
Is it possible?
This works in Firefox 5$('input[type="text"]').live('focus', function () { this.select(); });
http://jsfiddle.net/HmQxZ/13/
Chrome and IE8 only select all text in a second
It works * in Chrome $('input[type="text"]').live('click', function () { this.select(); });
http://jsfiddle.net/HmQxZ/12/
Firefox and IE8 selects all the text, but the next time you click, the text remains selected.
* type of work, after the text field has focus, clicking on it alternates between selecting the entire text and the possibility of clicking where the blinking carriage is going. This is probably acceptable.
source share