if (!$("#myTextArea").val()) {
// textarea is empty
}
You can also use $.trim
to make sure the element doesn’t contain only white-space:
if (!$.trim($("#myTextArea").val())) {
// textarea is empty or contains only white-space
}
if (!$("#myTextArea").val()) {
// textarea is empty
}
You can also use $.trim
to make sure the element doesn’t contain only white-space:
if (!$.trim($("#myTextArea").val())) {
// textarea is empty or contains only white-space
}