What's wrong with this code?



I have tried different ways of appending the paragraph but not working. Brought these errors.
Uncaught TypeError: "

I am a paragraph

".append is not a function
Oops, try again. It looks like you didn't add a

to the page. Check the Hint if you need help!

        ("<p>I am a paragraph</p>").append(".app");

#also tried this:

        ("<p>I am a paragraph</p>").appendTo("body");


Hi ! remember the correct syntax !

For .append( )
ex: $(document).ready( function( ){

For .appendTo( )

ex: $("<p>Stuff!</p>").appendTo('.info');

Now you have in the 1st code you tried, the order is wrong if you notice for .append( ) , first you need to fill in correctly $(' '), lets say what goes inside is what you re going to work on and then the message.

ex: $(' ').append('<p>stuff !</p>')

If you decide to use .appendTo( ), don't forget that you need the $ symbol !

ex: $(<p>Stuff !</p>).appendTo(' ');

Compare your code with this explanation, see whats missing and you will find the answer , if you still have trouble let me know! GL!

Happy Coding!


Thanks. It worked:slight_smile:


Glad to hear that !

Happy Coding !


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