tabbing between jeditable fields in a table

前端 未结 1 929
广开言路
广开言路 2021-01-06 06:14

I\'m using code from here http://www.korvus.com/blog/geek/making-the-tab-key-work-with-jeditable-fields/ to get tabbing between jeditable fields working, and if the fields a

相关标签:
1条回答
  • 2021-01-06 06:58

    I believe the issue is that your input fields are not direct siblings to each other, thus "next()" is failing. I think this will work:

    $('div.edit').bind('keydown', function(evt) {
    if(evt.keyCode==9) {
        var nextBox='';
        var currentBoxIndex=$("div.edit").index(this);
         if (currentBoxIndex == ($("div.edit").length-1)) {
               nextBox=$("div.edit:first");         //last box, go to first
           } else {
                nextBox=$("div.edit").eq(currentBoxIndex+1);    //Next box in line
           }
        $(this).find("input").blur();
        $(nextBox).click();  //Go to assigned next box
        return false;           //Suppress normal tab
    };
    }); 
    
    0 讨论(0)
提交回复
热议问题