Moving Elements Around


1) In script.js, add a new line below your code to move your <p> tag after the <div> with id #one

2) create a new jQuery selector that targets the <div> with the id #two

3) Using after again, select the <p> tag you created and move it after the <div> with id #two

I don't understand the first question in this instruction? I read other posts but it's just confusing me more. How do we move the <p> tag after the <div> with id #one? In reality isn't there like infinite ways to just write <p> on the next line? Shouldn't the question be more specific?

I'll be honest I don't really know how to really ask anymore of my questions for 2 and 3. I'm only assuming it's the same as before but now we just need to get the <p> in there.

Can someone please check my code to see if I did it correctly and please explain to me how it actually works? I'll be honest I was just writing until something turned the next button green.

$(document).ready(function() {
$("div#one").after("<p>'Teen Titans Go!'</p>");
var $paraTwo = $("p");

Is the $("p") in my var actualy pulling the <p> from my "div#one"? Also would it would work if I replaced the $("p") in "$div#two" with "$paraTwo"?

I guess what I'm asking is
the first line of my code is "When the HTML document is ready go to line 2 in the code".
the second line of code is "In div#one add a paragraph with the text Teen Titans Go!.
the third line of code ???
the fourth line "see second line of code but we put it in div#two instead.

Variables are confusing...?


The problems are actually in the second and forth line of your code:
The second line should be: $("#one").after.....//and then the rest of the code// there shouldn't be a "div" before the #one, make the same adjustment on the fourth line also.


Here is my code:



var $paragraph =$('p');


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