While valid, it goes beyond what the exercise expects. No harm, just give it what it wants.
There really is no reason to cache the jQuery object in this exercise. A transient selector is all we need.
When creating a jQuery object with a
Because of the wide coverage of a node type selector, they are the least desirable to have in our code, if not specifically suited to the design. That is where class comes in so we can isolate a select group of node type elements that are related by marriage, not as family. They all have the same class.
Where it gets interesting is when we create an element of any node type, P-node or any other, and make it a jQuery object.
$p = $('<p/>').text("I'm a sprite");
Now you have an object that resides in memory and is dynamic in insertion and removal, as well in text. Both can be changed on the fly anytime during a session.
Take some time to play with this idea and it will give you some practice with the before and after methods, as well as many others. You’ll have fun, guaranteed. Sprites are fun.