What is the easiest way to check in Javascript whether the input text field is empty (contains nothing or white spaces only)?
var str = document.getElementById("myInput").value; if (str.match(/^\s*$/)) { // nothing, or nothing but whitespace } else { // something }