PDA

View Full Version : Highlight Text or Search field on focus



kgilb
11 Feb 2011, 9:24 AM
Can anyone tell me how to highlight a text or search field on focus? I tried the code below but it doesn't seem to work:



listeners: {
focus: function (txt, e) {
txt.fieldEl.dom.select();
}
}

FPXdeveloper_4
8 Nov 2011, 6:59 AM
This worked for me.

onFocus:function(){
this.callParent(arguments);
this.inputEl.dom.select();
},

fox1charlie
22 Dec 2011, 2:10 AM
Sadly, webkit has a problem with calling either the "focus" event or the "select()" function, so the code above doesn't work without some kind of workaround.