4. Moving elements around


#1

This is my code:
$(document).ready(function(){
$("p").after($("#one"));
$("p").after($("#two"));
)};

I get following error, dont know how it works :
Oops, try again. It looks like your

is still after the

with ID #one.

#2

Hi S.A. Khalili,

You need to flip lines 2 and 3 around, like this:

$('#one').after('p');
// and the same thing with #two

#3

Thanx for quick reply, here is what I did:
$(document).ready(function(){
$('#one').after('p');
$('#two').after('p');
});
Still the same error:
Oops, try again. It looks like your p is still after the div with ID #one.


#4

Update--Below code worked:

$(document).ready(function(){
var $paragraph = $("p");
$("#one").after($paragraph);
$("#two").after($paragraph);
});


#5

A post was split to a new topic: Step 4, why am I getting this error?


#6