Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Перемещение элементов (https://javascript.ru/forum/jquery/73759-peremeshhenie-ehlementov.html)

laimas 12.05.2018 16:58

$(this).append($(this).siblings('.waper-catalog-row-col-4').children('span'));

$(this).siblings('.waper-catalog-row-col-4').children('span').appendTo(this);

face2005 12.05.2018 17:03

Спасибо большое!

j0hnik 12.05.2018 17:12

laimas,
:no: ничем не лучше

рони 12.05.2018 17:18

face2005,
<!DOCTYPE html>

<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
  </style>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script>
$(function() {
$( ".sepSt" ).each(function(i, el) {
    $(".waper-catalog-row-col-4 span",el).appendTo($(".waper-catalog-row-col-3", el))
	});
});
  </script>
</head>

<body>
<div class="sepSt">
    <div class="waper-catalog-row-col-3">
            <span>text</span>
    </div>
    <div class="waper-catalog-row-col-4">
            <span>другой text</span>
    </div>
</div>

<div class="sepSt">
    <div class="waper-catalog-row-col-3">
            <span>text</span>
    </div>
    <div class="waper-catalog-row-col-4">
            <span>другой text1</span>
    </div>
</div>

<div class="sepSt">
    <div class="waper-catalog-row-col-3">
            <span>text</span>
    </div>
    <div class="waper-catalog-row-col-4">
            <span>другой text2</span>
    </div>
</div>

</body>
</html>

j0hnik 12.05.2018 17:22

appendTo более тормозной чем append

laimas 12.05.2018 17:25

Цитата:

Сообщение от j0hnik
ничем не лучше

Один хрен, просто дважды получать $(this)...

Цитата:

Сообщение от j0hnik
appendTo более тормозной чем append

Стоит ли париться из-за копеечного выигрыша? Это уже паранойя. :)


Часовой пояс GMT +3, время: 23:57.