Table of Contents

jQuery - Dom Manipulation

Add an element

  <p class="beauty-blue">The first beauty-blue paragraph</p>
  <p>The second paragraph</p>
.beauty-blue { color: blueviolet; }
$('p').after('<div>After</div>');
$('p').after( function() {
  if (this.className != ""){
      return "<div>The class name of the previous element is " + this.className + "</div>";
  } else {
     return "<div>The previous element has no class name</div>";
  }
});