Jquery 4 Moving element Around


#1

Hello people, please help have a look at my code

$(document).ready(function () {
    $('#one').after("<p>Hola all</p>");
    $("#two").after($("p"));
    $('#one').after("<p>Hola all</p>");
    
    
    
});

#2

Hi Toby,

Try removing line 4. It's a duplicate of line 1, and doesn't belong there :slight_smile:


#3

Thanks tried both code;

$(document).ready(function () {
    $('#one').after("<p>Hola all</p>");
    $("#two").after($("p"));    
    
    
});

and

$(document).ready(function () {
    $('#one').after("<p>Hola all</p>");
    $("#two").after($("p"));
    $('p').after("#two");
    
    
    
});

and it work ? hmmn


#4

@tobydee The first code you have there is how it should be :slight_smile:

Good job!

P.S., see how to format code so it shows up properly here:

:wink:


#7

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.