Ads by ProfitSence

Clear all div's contents inside a parent div.

Last Updated on Wednesday 5th Oct 2022

.empty jquery

JQuery's empty() function does just that.

empty div jquery Syntax



Remove all child nodes of the set of matched elements from the DOM.This method removes not only child elements.



clears the container div.

jQuery clear div contents

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


clears all the child div

Remove the content of all <div> elements.



If you were trying to do this using Vanilla JavaScript, you could use the innerHTML property and set it to an empty string.

					document.getElementById('container').innerHTML = '';