Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Jquery question

Here is what I'm stuck on although it says I'm right:

Moving elements around in the DOM is a snap—all we need to do is use the jQuery functions we just learned on existing elements instead of creating new ones.

var $paragraph = $("p"); // existing element $("div").after($paragraph); // Move it! // Same as: $("div").after($("p"));

We can select an element using $("p") and assign it to a variable
We can move the position in the DOM by using the variable in our after() statement

Note: This does not copy the element from one location to another, it moves the original element effectively saving you from having to delete the original Instructions

In script.js, add a new line below your code to move your <p> tag after the <div> with id #one
create a new jQuery selector that targets the <div> with the id #two
Using after again, select the <p> tag you created and move it after the <div> with id #two

Here is my code:

/* This is from the previous exercise/* $(document).ready(function(){ $('one').after('<p>the code</p>'); }); /* This is the code for the current exercise. Please tell me how is this correct /* $(document).ready(function(){ var $j = $('<p>what</p>'); $('#one').after($('p')); $('#two').after($('p'));