Jquery.inside ()?
I was wondering if it is possible to insert content inside html tags. Say you have an h4 tag:
<h4>Some Header</h4>
And you want the text to be surrounded by a span with a "string" class as well. For instance:
<h4><span class="line">Some Header</span></h4>
I know about things like .after (), but is there something like .inside () for this? \
Ok ... I know I can do it manually, but in this situation it is out of the question.
thanks
+2
a source to share
5 answers
You should try wrapInner .
The .wrapInner () function can take any string or object that can be passed to the $ () factory function to indicate the DOM structure. This structure can be nested several levels deep, but should contain only one most closed element. the structure will be wrapped around the content of each of the elements into a set of consistent elements.
+1
a source to share