I have a div Example:
Use jQuery's CSS selector syntax to select all Using
div elements inside the element with id masterdiv. Then call empty() to clear the contents.$('#masterdiv div').empty();
text('') or html('') will cause some string parsing to take place, which generally is a bad idea when working with the DOM. Try and use DOM manipulation methods that do not involve string representations of DOM objects wherever possible.