js detect if content editable div is empty 1

js detect if content editable div is empty

  if ($('#divThatYouCanWriteStuffIn').text().trim().length == 0) {
    alert("empty");
  }

Here is what the above code is Doing:
1. It’s checking to see if the div with the id of “divThatYouCanWriteStuffIn” has any text in it.
2. If it does, it’s checking to see if the text is empty.
3. If it is empty, it’s alerting the user.

Similar Posts