EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Opan Mustopah on January 17, 2015, 09:39:37 AM



Title: how to set focus to textbox element, like combogrid and textbox
Post by: Opan Mustopah on January 17, 2015, 09:39:37 AM
night all,

the title says all.
how to do that?
here is my best shoot:

Code:
$('#tx').focus(); // not focus

// and i try to get textbox object
var t = $('#tx').combogrid('textbox');
$(t).focus(); // still can't getting focus

many thanks for the answer


Title: Re: how to set focus to textbox element, like combogrid and textbox
Post by: phunksta on May 21, 2015, 06:19:40 AM
Hi,

I have also found this recently: it seems impossible to change the focus using jquery or javascript focus.

I am not sure if this is an easyui issue or a browser one though.


Title: Re: how to set focus to textbox element, like combogrid and textbox
Post by: Opan Mustopah on May 21, 2015, 06:25:11 AM
thanks for response sir, are you succed doing this?


Title: Re: how to set focus to textbox element, like combogrid and textbox
Post by: alex_h on May 26, 2015, 02:14:20 AM
maybe u can change with this

Code:
var t = $('#tx').combogrid('textbox').focus();

// or this

var t = $('#tx').combogrid('textbox').focus();
t.focus();

sorry for my bad english


Title: Re: how to set focus to textbox element, like combogrid and textbox
Post by: phunksta on June 16, 2015, 03:20:33 AM
Hi, yes this is very much what I've been trying. I've put the .focus() function in numerous places, all of which are executed fine by the browser, but seemingly ignored i.e. the focus does not change.


Title: Re: how to set focus to textbox element, like combogrid and textbox
Post by: devnull on June 20, 2015, 02:58:31 AM
I have faced problems with focus() many times in the past and find that in most cases if you wrap it in a timeout it works:

Code:
setTimeout(function(){$('#xxx').focus()})