Add before and after : after « jQuery « JavaScript Tutorial






<html>
  <head>
    <script type='text/javascript' src='js/jquery-1.3.2.js'></script>
    <script type='text/javascript'>
$(document).ready(
  function() {
    $('p')
      .before(
        "<h4>Quotes</h4>"
      )
      .after(
        "<p class='tmpAttribution'>\n" + 
        " - after\n" +
        "</p>\n"
      );
  }
);
    </script>
    <style type='text/css'>
p {
    margin: 5px;
}
p.tmpAttribution {
    text-align: right;
}
    </style>
  </head>
  <body>
     <p>
       asdf
     </p>
  </body>
</html>








30.14.after
30.14.1.Add after text node created from document.createTextNode
30.14.2.Add after
30.14.3.Add after text node
30.14.4.Use after to switch node
30.14.5.Inserts a jQuery object (similar to an Array of DOM Elements) after all paragraphs.
30.14.6.Add before and after