1
I know you can validate with HTML5 or CSS, but just out of curiosity: I found a code on the net that checks if the syntax of a typed email is correct:
if(document.dados.email.value=="" || document.dados.email.value.indexOf('@') == -1 || document.dados.email.value.indexOf('.') == -1 )
{
And it works. The problem is that I cannot understand how this conditional value "-1" can be legitimate if there is no negative array or string value.
However basing myself on a thread of logic I assumed that "-1" meant "not to exist", hence I modified this to <0
and then to <1
and the two also worked.
Could you please give me a clearer explanation of this case?
If the answer solved your problem you can mark as accepted.
– Sergio