jQuery > Manipulations methods

.after() - Place content after element in jQuery

How to place content after a specific element in jQuery?


To place content after a specific html element, after() method can be used.

 <script>
      $("h1").after("<h2>This should be the sub heading</h2>");
  </script>

Above code snippet will place the specified text (<h2>This should be the sub heading</h2>) after “h1” element of the web page.

 Views: 4470 | Post Order: 50



Write for us






Hosting Recommendations