&引用;臭虫:使用jquery';输入字段上的s focus()方法,我可以';t用鼠标光标移动焦点光标

&引用;臭虫:使用jquery';输入字段上的s focus()方法,我可以';t用鼠标光标移动焦点光标,jquery,input,html-table,cursor,focus,Jquery,Input,Html Table,Cursor,Focus,它只对键盘箭头作出反应,而不对鼠标作出反应。但我想将焦点光标跳到我单击的位置。这是我使用的函数: $(function () { $("td").not(".cellEditing").dblclick(function () { var OriginalContent = $(this).text(); $(this).addClass("cellEditing"); $(this).html("<input type='text' id='textinput'

它只对键盘箭头作出反应,而不对鼠标作出反应。但我想将焦点光标跳到我单击的位置。这是我使用的函数:

$(function () {
$("td").not(".cellEditing").dblclick(function () {
    var OriginalContent = $(this).text();

    $(this).addClass("cellEditing");
    $(this).html("<input type='text' id='textinput' size='100' value='" + OriginalContent + "' />");
    $(this).children().first().focus();

    $(this).children().first().keypress(function (e) {
        if (e.which == 13) {
            var newContent = $(this).val();
            $(this).parent().text(newContent);
            $(this).parent().removeClass("cellEditing");
        }
    });

    $(this).children().first().blur(function () {
        $(this).parent().text(OriginalContent);
        $(this).parent().removeClass("cellEditing");
    });
});
});

你能在一个完成的过程中重现这个错误吗。但是它应该在那里工作,但不适合我:(那么问题很可能出在代码的其他地方。是的,删除上面的“可排序”代码是可行的。我的可编辑表仍然有足够的问题:D
$(function () {
$("#editableTable tbody.sortable").sortable({
    cursor: "move",
    //items: 'tr.sortable-row',
    stop: function () {
        oddRowColor();
    }
});

$("#editableTable tbody.sortable").disableSelection();

});