Javascript - clearing everything inside a div

javascript, jquery

Solution

The normal JavaScript method:

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

In jQuery:

$('#socialUserList').html('');

Pure JavaScript and jQuery go hand in hand, like so:

From pure JavaScript to jQuery:

var socialUserList = document.getElementById('socialUserList');
console.log($(socialUserList).html());

From jQuery to pure JavaScript:

var socialUserList = $('#socialUserList');
console.log(socialUserList[0].innerHTML);

Problem

I have div: ``` <div id="socialUserList"> //some content here, htmlTags, text, etc. </div> ``` Now, I want everything inside of that div to be wiped out. I am trying this: ``` $("#socialUserList").innerHTML = ''; ``` But for some reason it doesn't want to work. Why?

Original source