Validating empty textarea
Using regular expression to validate whether the text area is empty, and it should not allow the user to enter a space.
HTML
<textarea name="textarea1" id="textArea1" cols="30" rows="10"></textarea>
<button id="test">Check</button>
JavaScript
$("#test").click(function() {
alert("test");
var inputField = document.getElemenById("textArea1").value;
if(inputField.match(\s)){
alert("Entering only space is not allowed");
}else if(inputField == ""){
alert("please enter a value, textarea cannot be empty");
}else alert("Success");
});