输入元素在退格键的IE(10)中消失

时间:2013-06-04 07:31:11

标签: jquery asp.net textbox html-rendering

我有一个ASP.NET页面,它将数据库中的大量数据加载到ListView LayoutTemplateItemTemplate。当用户将鼠标悬停在一行上时,最后一列会切换其内容以包含相同值的文本框,从而使其可编辑。这适用于Chrome,现在我几乎可以在IE10中使用它。

还有什么问题,在文本框中退格时,第一次按键似乎会删除文本框本身,但会留下内容,第二次按键会使文本框和内容都不可见。单击文本框内部会再次显示它,因此将鼠标光标移动到文本框区域之外。

我无法做出这样的Snaggit,我试过了。

可悲的是,jsfiddle here在<{1}}中重现了 NOT 问题,因此,冒着旧的墙文本的风险,我包括了整个IE10希望其他人可以重现这一点并弄清楚我两天内无法做到的事情。别担心,这不是很大。我已经在另一台机器上测试了这段代码(使用相同版本的ASP.NET Page)并且问题是相同的。

像往常一样:对此问题的原因和方法有任何见解。

IE10

1 个答案:

答案 0 :(得分:0)

改变

//if the value changes
$clickedRow.find('input[id$="txtBoxInvoiceNumber"]').on('input propertychange', function () {
    //if the button was already visible, leave it that way
    if ($clickedRow.find('input[id$="btnSaveInvNrFormat"]').is(':hidden')) {
        $clickedRow.find('td[id$="SaveOption"]').show();
        $clickedRow.find('input[id$="btnSaveInvNrFormat"]').show();
    }

    //but if it changes back to what it was within the same 'mouseenter' moment
    if ($clickedRow.find('input[id$="txtBoxInvoiceNumber"]').val() == $clickedRow.find('span[id$="lblInvoiceNumber"]').text()) {
        $clickedRow.find('td[id$="SaveOption"]').hide();
        $clickedRow.find('input[id$="btnSaveInvNrFormat"]').hide();
    }
});

//if the value changes
$clickedRow.find('input[id$="txtBoxInvoiceNumber"]').on('input propertychange', function () {
    //but if it changes back to what it was within the same 'mouseenter' moment
    if ($(this).val() == $clickedRow.find('span[id$="lblInvoiceNumber"]').text()) {
        $clickedRow.find('td[id$="SaveOption"]').hide();
        $clickedRow.find('input[id$="btnSaveInvNrFormat"]').hide();
    } else {
        $clickedRow.find('td[id$="SaveOption"]').show();
        $clickedRow.find('input[id$="btnSaveInvNrFormat"]').show();
    }
});

解决了这个问题。