Skip to content Skip to sidebar Skip to footer

Re-arrange Dom Elements

I have the code below:

Solution 1:

Have you tried this approach?

var content = $('.grp-help').html();
$('.grp-help').remove();
$('.c-1').append('<span class="grp-help">' + content + '</span>');
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divclass="grp-row grp-cells-1"><divclass="l-2c-fluid l-d-4"><divclass="c-1"><labelfor="sometext">Label</label></div><divclass="c-2"><selectid="sometext"name="somename"><optionvalue=""selected="selected">Option</option></select><pclass="grp-help">bla</p></div></div></div>

Solution 2:

To avoid duplication you should detach:

$element = $('span.grp-help');
$element.detach();
$element.appendTo('div.c-1');

Post a Comment for "Re-arrange Dom Elements"