Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to append on sibling in jQuery?

Tags:

html

jquery

I have this code

<div class="data">  <div class="another"> </div> <!-- need to add element here -->  </div> 

I want to add the element where I put comment using jQuery how I can append sibling of another using jQuery

like image 852
Anirudha Gupta Avatar asked May 27 '11 08:05

Anirudha Gupta


1 Answers

If you specifically want to insert after the another div element, try insertAfter:

$('<div>Another 2</div>').insertAfter($('.another')); 

In the $('.another') part, you can otherwise specify the target more precisely.

like image 89
Alex R. Avatar answered Sep 28 '22 17:09

Alex R.