小编mat*_*jkd的帖子

在表格中的可切换字段之间进行选项卡

我正在使用http://www.korvus.com/blog/geek/making-the-tab-key-work-with-jeditable-fields/中的代码来获取可裁剪字段之间的标签,如果字段是他们自己工作得很好.但是我需要将我的字段放在一个表中,并且tab键工作的唯一时间是从最后一个字段到第一个字段的标签,当然我需要它从第一个字段到下一个标签,依此类推......

$('div.edit').bind('keydown', function(evt) {
if(evt.keyCode==9) {
    $(this).find("input").blur();
    var nextBox='';

     if ($("div.edit").index(this) == ($("div.edit").length-1)) {
           nextBox=$("div.edit:first");         //last box, go to first
       } else {
            nextBox=$(this).next("div.edit");    //Next box in line
       }
    $(nextBox).click();  //Go to assigned next box
    return false;           //Suppress normal tab
};
});
Run Code Online (Sandbox Code Playgroud)

表的格式如下

<table>

<tr>
  <td class='leftcolumn'>
     <strong>Firstname:</strong>
  </td>
  <td>
     <div class='edit' id='firstname'><?=$userdetail['firstname']?></div>
  </td>
</tr>

<tr>
  <td class='leftcolumn'>
     <strong>Lastname:</strong>
  </td>
  <td>
     <div class='edit' id='lastname'><?=$userdetail['lastname']?></div>
  </td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)

提前致谢

jquery jeditable

4
推荐指数
1
解决办法
1804
查看次数

标签 统计

jeditable ×1

jquery ×1