'Javascript - can it only return false?
Javascript - can it only return false?
If I delete -
else
{
alert('Keyword has accepted');
return true;
}
, whole code wont work.
function required(look_for)
{
var empt = look_for;
if (empt.value.length == 0)
{
alert("Please input a Keyword");
return false;
}
else
{
alert('Keyword has accepted');
return true;
}
}
Solution 1:[1]
It's probable that it should be empt.length not empt.value.length
This depends on what you send to the function, I assume you sent a string
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jeekiii |
