<tfoot id='RG0rD'></tfoot>

    <small id='RG0rD'></small><noframes id='RG0rD'>

        <i id='RG0rD'><tr id='RG0rD'><dt id='RG0rD'><q id='RG0rD'><span id='RG0rD'><b id='RG0rD'><form id='RG0rD'><ins id='RG0rD'></ins><ul id='RG0rD'></ul><sub id='RG0rD'></sub></form><legend id='RG0rD'></legend><bdo id='RG0rD'><pre id='RG0rD'><center id='RG0rD'></center></pre></bdo></b><th id='RG0rD'></th></span></q></dt></tr></i><div id='RG0rD'><tfoot id='RG0rD'></tfoot><dl id='RG0rD'><fieldset id='RG0rD'></fieldset></dl></div>

        <legend id='RG0rD'><style id='RG0rD'><dir id='RG0rD'><q id='RG0rD'></q></dir></style></legend>

        • <bdo id='RG0rD'></bdo><ul id='RG0rD'></ul>

      1. Jquery追加而不删除

        Jquery appending without removing(Jquery追加而不删除)

            <bdo id='NnEni'></bdo><ul id='NnEni'></ul>
              <tbody id='NnEni'></tbody>

                <legend id='NnEni'><style id='NnEni'><dir id='NnEni'><q id='NnEni'></q></dir></style></legend>
                • <i id='NnEni'><tr id='NnEni'><dt id='NnEni'><q id='NnEni'><span id='NnEni'><b id='NnEni'><form id='NnEni'><ins id='NnEni'></ins><ul id='NnEni'></ul><sub id='NnEni'></sub></form><legend id='NnEni'></legend><bdo id='NnEni'><pre id='NnEni'><center id='NnEni'></center></pre></bdo></b><th id='NnEni'></th></span></q></dt></tr></i><div id='NnEni'><tfoot id='NnEni'></tfoot><dl id='NnEni'><fieldset id='NnEni'></fieldset></dl></div>

                  <small id='NnEni'></small><noframes id='NnEni'>

                  <tfoot id='NnEni'></tfoot>
                • 本文介绍了Jquery追加而不删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以我需要从特定类中获取内容并将其放入一个 div 中,我使用 append 来......我的问题是 append 删除了我附加的项目,我需要它留在那里,这是我的代码:

                  So I need to grab content from a specific class and put it in a div, which I use append for...my issue is that append removes the item I append, and I need it to stay there, Here is my code:

                  $(document).ready(function(){
                      var $content = $('#popupcontent');
                      var $window = $('#popupwindow');
                      $('.open').click(function(){
                          //alert('runnning');
                          var a = $(this).contents('span');
                          $content.append(a);
                          $window.fadeIn(300);
                      });
                      $('.close').click(function(){
                          //alert('running');
                              var a = $content.contents('span');
                          $window.fadeOut(300);
                          $('#popupcontent span').remove();
                      });
                  });
                  

                  那么如何在点击时从每个 .open span#popupcontents id 获取内容而不将其从 中删除.打开类?

                  So how can I get the content, when clicked, from each .open span to the #popupcontents id without removing it from the .open class?

                  向您展示我的意思:JSFIDDLE

                  注意:第二次单击链接时,它不会附加任何内容,因为该内容已从该类中删除,这不是我想要的

                  NOTE: the second time you click a link, it wont append any content because that content has been removed from that class, which is not what I want

                  注意 2:我不能简单地在 $('.close').click 函数中仅使用 append 而不是 remove,因为我无法检测到内容来自 .open 类的哪个实例.

                  NOTE2: I cannot simply just append instead of remove in the $('.close').click function because I cannot detect which instance of the .open class the content came from.

                  推荐答案

                  需要克隆元素并追加克隆:

                  You need to clone the element and append the clone:

                  $('.open').click(function(){
                      //alert('runnning');
                      var a = $(this).contents('span');
                      $content.append(a.clone());
                      $window.fadeIn(300);
                  });
                  

                  演示

                  这篇关于Jquery追加而不删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Toggle HTML radio button by clicking its label(通过单击标签来切换 HTML 单选按钮)
                  Javascript how to change radio button label text?(Javascript如何更改单选按钮标签文本?)
                  JavaScript radio button confirmation(JavaScript 单选按钮确认)
                  How can I automatically select specific radio buttons with Greasemonkey?(如何使用 Greasemonkey 自动选择特定的单选按钮?)
                  AngularJs. Is it possible to deselect HTML “radio” input by click?(AngularJs.是否可以通过单击取消选择 HTML“收音机输入?)
                  Checking Value of Radio Button Group via JavaScript?(通过 JavaScript 检查单选按钮组的值?)

                  <tfoot id='9m1Ms'></tfoot>
                    <tbody id='9m1Ms'></tbody>
                        • <bdo id='9m1Ms'></bdo><ul id='9m1Ms'></ul>

                          <i id='9m1Ms'><tr id='9m1Ms'><dt id='9m1Ms'><q id='9m1Ms'><span id='9m1Ms'><b id='9m1Ms'><form id='9m1Ms'><ins id='9m1Ms'></ins><ul id='9m1Ms'></ul><sub id='9m1Ms'></sub></form><legend id='9m1Ms'></legend><bdo id='9m1Ms'><pre id='9m1Ms'><center id='9m1Ms'></center></pre></bdo></b><th id='9m1Ms'></th></span></q></dt></tr></i><div id='9m1Ms'><tfoot id='9m1Ms'></tfoot><dl id='9m1Ms'><fieldset id='9m1Ms'></fieldset></dl></div>
                            <legend id='9m1Ms'><style id='9m1Ms'><dir id='9m1Ms'><q id='9m1Ms'></q></dir></style></legend>

                            <small id='9m1Ms'></small><noframes id='9m1Ms'>