JQuery and ASP.net with DIV



我在jQuery中有一个HTML表。该HTML表中有几行可用。在那个表中,我在第一个TD中添加了div。第一个TD有文本框。div的默认显示为none。当我输入值到第一个TD的div id值=输入第一个TD文本框值的值。像这样,我如何在HTML表.....中输入第一个TD后追加/分配div id值我是JQuery的新手

$items = $items + '<td width="16px" ><img onclick="pop(this);" id="imgpop" width="16px" style="cursor: pointer;" height="16px" src="../Images/plus.gif" /><input type="text" style="width:80%;" class="mtextbox" autocomplete="off" onfocus="FnAutocomNo(this, 'FWHSortCode',1);" onblur="createRow(this);" name="txtSortCode" id="txtSortCode" />'; $items = $items + '<input type="hidden" name="hdnSortId" id="hdnSortId" />'; $items = $items + ' <div id="popDiv1" class="menu" style="display:none;"><table id="popup1"><tr><td colspan="10"></td></tr></table></div></td>';

我认为这是你需要的…!演示HTML:

<table>
    <tr>
        <td>
            <div id="divid"></div>
                <input id="inputid" type="text"></input>
        </td>
    </tr>
</table>
JQuery

$(document).ready(function () {
    $("#inputid").on('keyup',function(){
        $("#divid").text($(this).val());
    });
});

最新更新