Currently, I have a statement that checks if any of the Divs with the ID #Drop are empty. If one is found to be empty, an alert is shown. However, there seems to be an issue where the statement stops working when any div contains content.
What I am trying to achieve is for an alert to display if ANY div is empty. There are 4 Divs in total, and the alert message should appear whenever there is an empty div irrespective of whether other divs contain content.
HTML:
<div id="Drop1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<div id="Drop2" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<div id="Drop3" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<div id="Drop4" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
JS:
$("#run").click(function(){
if ($("[id^='Drop']").html() === ""){
alert("empty")// ...
}
});