3. before and after


$(document).ready(function() {

hi how are
please help I have no idea what is wrong with this code.


For this activity, you need to add an HTML tag .after an HTML element with a certain id.

In the code you provided, I can see 2 problems
1) $('.one')... The thing you have within the bracket is the way to 'ask' for a class. a class is .className className being your class name. In the brackets you would want to replace the period/fullstop with a hash pound symbol(#) and you code would look like so, $(#one)...

2) The proper syntax for a .after is $('target').after(thingToAdd); You almost have it right there but, you are adding a <p> tag so, you need to change the code to put in the


Altogether, the improved code would be:

$('#one').after('<p>hi how are<p>');

Hope this helped!



   $('#one').after('<p>Any text you like after\'ed</p>');
//   $('#one').before('<p>Any text you like before\'d</p>');
//   $('#one').append('<p>Any text you like appended</p>');
//   $('#one').prepend('<p>Any text you like prepended</p>');

google search
== the Book ==
after() site:jquery.com

As a training for jQuery-Selector-types
= http://www.w3schools.com/jquery/trysel.asp


Make sure you close your p tag!


Line two does not have the hashtag sign # before 'one'
line 3 after braces it is supposed to start with a paragraph tag "
<'opening p>hi how are <'/closing p>

The code should look like this. take out the ' i put in front of the opening p and the closing p

$(document).ready(function() {
$('#one').after('<'p>hi your cool<'/p>');



One thing important here is code must and should wrapped in document.ready, without this code not working.

    $("div#one").after("<p>Hello world!</p>");


i talked to customer support on this and the problem was the exercise doesnt want $(document).ready();.... it just wants the command itself. bit of an oversight it seems but i got it working.