Is it possible to chain together DOM manipulation code so that it adds to the prior selector?
I’ve experimented with add() andSelf() etc etc, but can’t seem to get anything to work:
Here is a rudimentary example I’ve put together, with some made up jquery code…
<ul>
<li></li>
<li></li>
<li></li>
</ul>
And I wanted to result in:
<ul>
<li><p><span>Hello</span>alex</p></li>
<li><p><span>Hello</span>alex</p></li>
<li><p><span>Hello</span>alex</p></li>
</ul>
I’m wondering if there is a syntax similar to this (my jquery pseduo code):
$("li").prepend("<p>alex</p>").prepend("<span>Hello</span>");
thanks for the help
You can use prependTo: