jQuery focus on content of input / textarea - not working properly in IE8
- by katebp
I want the input fields on my site to select all the text when the user first clicks on them, but in IE8 the text is selected for a split second then reverts back to normal. Works fine in FF.
My js code:
$(document).ready(function () { //HTML DOM document is ready
// Add this behavior to all text fields
$("input[type='text'], textarea").live("focus", function(){
// Select field contents
this.focus();
});
});
Any ideas? I've tried adding ".select()" after "this" and bizarrely enough it works, but throws loads of js errors in FF and IE.
Thanks