EasyUI Forum
May 15, 2024, 11:21:23 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: setting the focus to textbox inside accordion onSelect event  (Read 7120 times)
jrnfs
Newbie
*
Posts: 16


View Profile Email
« on: April 10, 2015, 07:43:53 AM »

Hi,
I have an accordion withing some textboxes. When I select a page I want to set focus to a specific textbox, like

<div class="easyui-accordion" data-options="onSelect:acc_select ... etc, etc...">
   <div title="user info" etc..>
      <input id='id_user' class="easyui-textbox" ...

function acc_select(title, index) {
   if (index = 0) {
      $('#id_user').textbox('textbox').focus();
   }
}


but nothing happen.
What am I doing wrong?
tks for any answer
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 10, 2015, 08:05:00 AM »

Some mistakes occur in your code, please try this:
Code:
function acc_select(title, index) {
   if (index == 0) {
      $('#id_user').textbox('textbox').focus();
   }
}
Logged
jrnfs
Newbie
*
Posts: 16


View Profile Email
« Reply #2 on: April 10, 2015, 08:19:34 AM »

Tks for your answer.
Yes, the '=' is wrong, but it is not the real code, my mistake. It still donĀ“t work.
I added a button to do the same code ($('#id_user').textbox('textbox').focus()) and it worked.
I guess there is something wrong with the event handler.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: April 10, 2015, 08:28:25 AM »

Please refer to this example http://jsfiddle.net/fb273m03/
Logged
jrnfs
Newbie
*
Posts: 16


View Profile Email
« Reply #4 on: April 10, 2015, 08:42:47 AM »

Solved, thank you so much.
Logged
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!