How can I detect if a div is empty except for the placeholder element/value?
Scenario 1: Div is empty
<div id="textarea" contenteditable="true">
<span id="textarea-placeholder" data-text="Enter comment"></span>
</div>
Scenario 2: Div has content
<div id="textarea" contenteditable="true">
<span id="textarea-placeholder" data-text="Enter comment"></span>
abc text inside div
<a></a> //other elements
<p></p> // other elements
</div>
Tried solutions:
$("#textarea").text().length) == 0
$('#textarea').find('*').not('.textarea-placeholder').is(':empty');