1
Whenever I do a javascript validation of a text box, to know if it is empty or not, I do it as follows:
function validar(){
    var input = document.getElementById("texto");
    if(input.value == ""){
         alert("Preencha todos os campos em branco.")
    }
}
However, today I discovered that this has a fault if the user leaves in the text box a space like this:

... and validate the form will not recognize as empty.
Although it is possible to do this:
function validar(){
    var input = document.getElementById("texto");
    if((input.value == "") || (input.value == " ")){
         alert("Preencha todos os campos em branco.")
    }
}
.. and knowing that there are these amazing solutions, I need to know if it is possible to verify if there are any characters inside the text box. And a way to do it in pure javascript.
A space is a character, as well as a
. e ,which by their verification would be valid. It would be more interesting to use a validation rule or define a minimum number of char.– Papa Charlie