【问题标题】:JQuery and ASP.net with DIV带有 DIV 的 JQuery 和 ASP.net
【发布时间】:2014-06-14 14:21:21
【问题描述】:

我在 jQuery 中有一个 HTML 表格。该 HTML 表格中有几行可用。在该表格中,我在第一个 TD 中附加了 div。第一个 TD 有文本框。div 的默认显示为无。当我第一个输入值时TD div id value=value 输入了第一个 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和脚本有用的部分。
  • 不在这里。在问题中。 Check this link.

标签: jquery html


【解决方案1】:

我认为这就是您所需要的..! DEMO 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());
    });

});

【讨论】:

  • 感谢 Kamesh,但我只使用了一个 DIV,它以重复的方式出现。例如,我有 3 个基于文本框值的文本框,我只需要使用一个 DIV 创建 3 个不同的 DIV。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-07-21
  • 2012-06-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多