<ul class="radioUL">
<li class=" mR30 editstatus" value="1"><i></i>启用</li>
<li class="editstatus" value="0"><i></i>用户禁用</li>
</ul>
$(".editstatus").each(function (){ if($(this).hasClass("act")){ status=$(this).val(); } }); if(status == ""){ alert("Please enter a value: ") }
It is found that when status == 0, the judgment is true.
Summarize the knowledge point:
In javascript, the variables named below are all false
var s = "",, i = 0, b = false, n = null, undefined;
in JavaScript , null, 0, "", false, and undefined are all equal to each other (==) because they all evaluate to 'false