jQuery Clear Div Contents

Sam Deering
Tweet

Simple jQuery code snippet to clear the contents of a div. Nothing special, this function shows just how easy it is to remove stuff from the DOM using jQuery.

$('#div').empty();

Read more: http://api.jquery.com/empty/

$('#div').remove();

Read more: http://api.jquery.com/remove/

Free JavaScript: Novice to Ninja Sample

Get a free 32-page chapter of JavaScript: Novice to Ninja and receive updates on exclusive offers from SitePoint.

  • http://www.jampersonals.com Jamaica Dating

    Thank you for this post, was looking for a quick reference and came across your post.

  • charan

    Thank you for the solution.