TL;DR Summary
Most important thing you need to remember when trying to clear innerHTML with jQuery is that you do not touch innerHTML at all.
What you need to do is use .html()
function that is already available in jQuery.
Here is the code example:
<div id="container">
<div class="myclass">HTML one</div>
<div class="myclass">HTML two</div>
<div class="myclass">HTML three</div>
</div>
<script>
// this is how you can read HTML
$('#container').html();
// this is how you delete HTML
$('#container').html('');
</script>
And that is all you need to know about clearing innerHTML with jQuery.
Until next time,
Will
P.S. check out my Algo-Trading Journey articles
Top comments (0)