Dear W3schools community,
I want to check if a required input is empty (has more then 0 characters). You guys have any idea what I'm doing wrong?
Thanks in advance!
If there is no character in input (id="vname") I still get a red "bar"
Here's my code:
function foobar()
{
var vname = document.getElementById('vname').value;
if (vname.length > 0 && vname != '' && vname != null)
{
document.getElementById('contact-response').style.color = 'green';
document.getElementById('contact-response').innerHTML = "foo";
}
else
{
docum