In general, there is a function .wrap , as I know it wraps the element you need in tags. In this way.

 $('#array').wrap('<span class="arrow"></span>'); 

How it looks on p.

 <span class="arrow"> <div id="array"></div> </span> 

Tell me how to do what would look like this.

 <span class="arrow"> <span class="under"></span> <div id="array"></div> </span> 

Ie to wrap the element in the tags and still put some tags on top. UPDATE. Or even it is just enough that the <span class = "arrow"> tag does not wrap the <div id = "array"> element and add to the inside of the element. Yes, I think it will be even better

    1 answer 1

     $('#array').wrap('<span class="arrow"></span>'); $('<span class="under"></span>').insertBefore('#array'); 

    .insertBefore ()

    • Thank you, what you need - alexland