jQuery Clear Div Contents

Sam Deering
Share

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/