<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追加而不删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words 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'>