为什么我的jquery在几秒钟后消失了? [英] Why does my jquery is disappearing after a few seconds?

查看:103
本文介绍了为什么我的jquery在几秒钟后消失了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我需要帮助,我有一个克隆div的按钮,但几秒后克隆的div消失了



Hi guys i need a help here, i have a button that is cloning a div, but after a few seconds the cloned div is disappearing

<b>HTML Code:</b>
<pre lang="Javascript">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <ContentTemplate>
      <div class="panel-body" style="overflow: auto; height: 659px;">
        <div class="personalInfo">
          <table class="tableOverride table-responsive">
            <tr>
              <th>Mobile Number:
              </th>
              <td>
                <asp:TextBox ID="txtBoxMobileNum" runat="server" CssClass="form-controlOverride"></asp:TextBox>
              </td>
            </tr>
            <tr>
              <th>Home Number:
              </th>
              <td>
                <asp:TextBox ID="txtBoxHomeNum" runat="server" CssClass="form-controlOverride"></asp:TextBox>
              </td>
            </tr>
            <tr>
              <th>Personal Email:
              </th>
              <td>
                <asp:TextBox ID="txtBoxPersonalEmail" runat="server" CssClass="form-controlOverride"></asp:TextBox>
              </td>
            </tr>
          </table>
        </div>

        <div>
          <div class="text-center">
            <button id="clonePersonalInfo" class="btn btn-default" style="height: 30px; text-decoration: underline;">Add Contact Information</button>
          </div>
          <div class="pull-left">
            <asp:Button ID="btnSavePersonalInfo" runat="server" Text="Save" Width="100px" Height="30px" CssClass="btn btn-primary" />
          </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>
</pre>





我尝试过:



jquery代码:



What I have tried:

jquery Code:

$(document).ready(function () {
    $('#clonePersonalInfo').click(function () {
        $('div.personalInfo').after(function () {
            return $(this).clone();
        });
    });
});

推荐答案

document )。ready ( function (){
(document).ready(function () {


' #clonePersonalInfo')。click( function (){
('#clonePersonalInfo').click(function () {


' div.personalInfo')。after( function ( ){
return
('div.personalInfo').after(function () { return


这篇关于为什么我的jquery在几秒钟后消失了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆