EasyUI Forum
May 03, 2024, 06:28:12 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how to set focus to textbox element, like combogrid and textbox  (Read 12594 times)
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« 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
Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
phunksta
Jr. Member
**
Posts: 54


View Profile Email
« Reply #1 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.
Logged
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« Reply #2 on: May 21, 2015, 06:25:11 AM »

thanks for response sir, are you succed doing this?
Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
alex_h
Newbie
*
Posts: 1


View Profile Email
« Reply #3 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
Logged
phunksta
Jr. Member
**
Posts: 54


View Profile Email
« Reply #4 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.
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #5 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()})
Logged

-- Licensed User --
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!