check if tag is empty jquery code example
Example 1: jquery if div is empty
function isEmpty( el ){
return !$.trim(el.html())
}
if (isEmpty($('#element'))) {
// do something
}
Example 2: how to innerhtml is empty
element.innerHTML.length == 0 ? element.appendChild(createdEl) : (element.innerHTML = '', modalNote.appendChild(createdEl));