4 moving elements around. please help


#1

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

#2

Hi Pascac,

You should remove your first 4 lines of code, then put $('#two') on the line after $('#one'). That way it looks like this:

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

...then, you should change your second <p>hello</p> into $('p') :slightly_smiling:

Edit:
Next time, please include a link to the exercise you're on and the error message you're getting.
Also, format your code properly, please!


#3

I do not understand the second part of your answer."then, you should change your second

hello

into $('p')". What is $('p')?

#4

@pjmcder You should've covered this several times by now in the course. $('p') is a jQuery selector that selects all <p> tags on the page.


#5

My problem is the instructions make no sense to me. Why would you not
just move the <p> element after #two to start with?


#6

@pjmcder So you can learn jQuery better :slightly_smiling:


#7

I could not visualize what the output should look like. Mine ended up looking like, and it passed

Doc1
Doc2

Hello


#9