jQuery > Manipulations methods

.insertAfter() - Insert after specific element in jQuery

How to insert an element after a specific element in jQuery?


To insert an html element after specified html element, insertAfter() method can be used.

 <script>
      $("h1").insertAfter("#div3");
  </script>

Above code snippet will insert “h1” element/tag after the element whose id is “div3”.

Here, we have used element selctor and id selector.

 Views: 8073 | Post Order: 53



Write for us






Hosting Recommendations