sephiith sephiith - 1 year ago 95
Javascript Question

How to remove a div's content with jQuery

How would I go about removing the content inside a div tag with the class


<div class="content"></div>

I would imagine it would be something like:


Separately, how would I go about adding a string of text inside that same

Answer Source

Use .empty() to remove the contents in the Div tag.


For your second question; you can add the any text or content using $('.content').html(newcontent) or

$('.content').text(newcontentText); //specifically for text content.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download