Need help with "Before & after"


#1


https://www.codecademy.com/courses/web-beginner-en-v6phg/0/3?curriculum_id=50a3fad8c7a770b5fd0007a1


I have tried many different entries and even went on youtube, but i'm still getting this exercise incorrectly. Below is the error message that I keep getting. Please help. Thanks
Oops, try again. It looks like you didn't insert your

after the

with ID #one.


 
$(document).ready(function() {
$('div ID#one').after('<p>hopefully this works</p>');

}):


#2

$(document).ready(function() {
$('#one').after('

hopefully this works

');
});

try this


#3

Thanks @miguell997 for the reply, but that too didn't work.


#4

I figure out what my mistake was.


#5

what is it?? I need help..... :frowning:


#6

Hi there. When you place the

tags for the element you're placing after div #one, don't put it between
"". Those were just used as examples to represent any tag that you would use, be it a p,
h1, div, etc. tag. Hope this helps.


#7

var $paragraph = $("p");
$("#two").after($paragraph);

The target (#two) is where you want to PUT the paragraph. This exercise was worded a little weird but if you refer to the previous exercise again that might help you understand.


#8

Hello. From the code you provided, this would be the correct way to solve it:

$(document).ready(function() {
  $('div#one').after('<p>hopefully this works</p>');
}):

This way you say "give me div element where id equals one".


#9

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