English 中文(简体)
在一张桌子上用j Query到下个牢房
原标题:Using jQuery to Tab to next cell in a table

我试图利用“ j”在一张桌子上向下囚室tab,但未获成功,并相信这是由于我的挑选者有错误。 借助开发工具,我发现,我的囚室是一个横跨,在“条码”和“条码”内。 在这里,Im试图使用。

$(function() {
    $( .EditText :text ).live("keydown", function(e) {
        if (e.which == 9) { //tab Key                                   
            $(this).blur();
            $(this).parent( tr ).next( td #EditText ).find( span ).click();
            return false;
        }
    });
});
最佳回答

我认为:

$(this).parent( tr ).next( td #EditText ).find( span ).click();

应:

$(this).next( td.EditText ).find( span ).focus();
问题回答

页: 1 如果你能够显示实际的标识,那么我就坐下来:

// Replace this
$(this).blur();
$(this).parent( tr ).next( td #EditText ).find( span ).click();
// With this
$(this).blur().closest( td ).next().find( td .EditText span ).focus();

我也决定对此作一.。 我为这一gu创造了一个jsfiddle,这样可以检查,让我知道它是否正确。

Here s the js in a nutshell for my current example:

$( table tr td.EditText span input ).live( keydown , function(e) {
    // get the code of the key that was pressed
    var code = e.keyCode ? e.keyCode : e.which;

    // varify that the tab key was pressed
    if (code === 13) {
        // get the next tr s input field, and set focus to it
        $(this).parents( tr ).next().find( td.EditText span input ).focus();

        // prevent any default actions
        if (e.preventDefault) {
            e.preventDefault();
        }
        return false;
    }
});




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签