I'm after the following functionality:
- user clicks on or tabs into a textbox
- all text in the textbox is selected, unless the textbox already had focus, in which case the default clicking/selecting functionality should occur
Is this possible?
This works in Firefox 5
$('input[type="text"]').live('focus', function () {
this.select();
});
Chrome and IE8 selects all the text for only a split second
This works* in Chrome
$('input[type="text"]').live('click', function () {
this.select();
});
Firefox and IE8 selects all text but upon subsequent clicking, the text remains selected.
*kind of works, after textbox has focus, clicking on it alternates between selecting all text and being able to click where the blinking caret goes. This is probably acceptable.