我在 html 正文中有这个跨度:
<span id="username_status"></span>
sql查询片段:
if($exist > 0)
{
echo 'Sorry, That username is Taken!'; //value in username_status
}
else{
echo 'Username available!'; //value in username_status
}
我正在尝试使用查询结果生成表单验证警报:
var s1 = document.getElementById('username_status').innerHTML;
if (s1 === "Sorry, That username is Taken!")
{
alert("Please Change Your Username. It is already used.");
return false;
}
}
我已经广泛搜索,但看起来我什么也没得到。有什么帮助吗?