Hello everyone, I need help:

There is content like

<ul> <li class="disds"><img src=".jpg"> <div class="bluur" style="font-size:1.0em; "> <span class="bluurspan" style="display:none;"> <p>Все здорово! Процветания и удачи!</p> </span> </div> </li> <li class="disds"><img src=".jpg"> <div class="bluur" style="font-size:1.0em; "> <span class="bluurspan" style="display:none;"> <p>Блаблабла</p> </span> </div> </li> </ul> 

There is a hidden window that is shown by clicking on the image.

  <div class="eeeew"> <div class="sadasd2"> Сюда нужно клонировать контент </div> </div> 

How to clone hidden text (.bluurspan) into .eeeew block?

  • So what? There are they, what's next? - Yuri
  • $ (".hello") .clone (). appendTo (".goodbye") || jQuery('ul li span.bluurspan').click(function() { var clone = jQuery(this).html(); jQuery('.sadasd2').html(clone); }) - Lieutenant Jim Dangle
  • What does content clone mean? What exactly needs to be inserted into sadasd2 ? - Grundy
  • @grundy this one <span class = "bluurspan" style = "display: none;"> <p> Blablabla </ p> </ span> - Mimzik
  • Add it directly to the question. Just need a span and not just the text of it? - Grundy

1 answer 1

Clicking can be processed through click and further through find we look for the necessary element:

 $(function() { $('.disds').click(function() { var content = $(this).find('.bluurspan').html(); $('.sadasd2').html(content) }); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <ul> <li class="disds"> <img src=".jpg"> <div class="bluur" style="font-size:1.0em; "> <span class="bluurspan" style="display:none;"> <p>Все здорово! Процветания и удачи!</p> </span> </div> </li> <li class="disds"> <img src=".jpg"> <div class="bluur" style="font-size:1.0em; "> <span class="bluurspan" style="display:none;"> <p>Блаблабла</p> </span> </div> </li> </ul> <div class="eeeew"> <div class="sadasd2"> Сюда нужно клонировать контент </div> </div> 

  • Thank you for what you need. I 'm just starting to delve into js =) - Mimzik