Modifying HTML Elements #4


#1

$(document).ready(function (){
$('#one').after('<p>Hello I just added p tag!</p>');
var $paragraph = $('p')
});
$(document).ready(function (){
$('#two').after($('<p>Hello</p>'))
});

I am having trouble with this code in jQuery. I tried looking around to see other's trouble like mine and still not getting it. The error messages I kept getting is: Oops, try again. It looks like your <\p> is still after the <\div> with ID #one.


#2

Hi Michael,

As a start, you should only have one $(document).ready(...);. So condense your code like this:

$(document).ready(function() {
  // ...
});

Then, after #two should be $paragraph, not <p>Hello</p>. .
I think this should get you passed, but I haven't tested. Please let me know if you're still having trouble passing the exercise :slightly_smiling:


#3

I was still puzzled after your comment but I finally got it. Thanks for the replied!