What I don't get in Moving Elements Around; Question


    $("#one").after("<p> This is a test </p>");

what are the reasons I have to use ($(p)) for id #two instead of just selecting the paragraph tag (<p>);
Example $("#two").after ("< p>");

Is it because there are no <p> tags in the html document; and in order to select the <p> tag we created in jQuery we have to use ($("p"))???

I gathered that this exercise focuses on explaining how we can select elements and how we can use the variable or the value interchangeably to make it move.

Thank you in advance.


This will create another paragraph element in the page, not move the one above to the new position.

In the first line, ('#one') we create a paragraph element containing some text. That element is inserted into the DOM so now we have one targetable P-node. That is what the second line does. It targets the p selector and moves the resulting object.



Oh I see; thank you!