我想使用textbox
验证我的jquery
。
如果字母数量为&#39;长度增加到6,它将隐藏我的<span>
标记
HTML:
<input type="password" id="txtpass" value="" onkeyup="KeyUp();"/>
的javascript:
function KeyUp () {
var x =$("#txtpass").val();
if (x.length < 6) {
$("span").show()
}
else
(x.length >= 6)
{
$("span").hide();
}
}
建议
答案 0 :(得分:1)
使用jquery的keyup函数并查找长度并显示/隐藏(或使用切换):
.NET
答案 1 :(得分:1)
您可以按DECLARE
SMTPServer mytable.smtpserver%type;
l_set_smtpserver_stmt VARCHAR2(600) := q'#ALTER SESSION SET smtp_out_server = ':p_smtp_server'#'
BEGIN
SELECT smtpserver INTO SMTPServer FROM mytable;
IF SMTPServer IS NOT NULL THEN
EXECUTE IMMEDIATE l_set_smtpserver_stmt USING SMTPServer;
END IF;
EXCEPTION
-- handle no_data_found exception since you're using select .. into statement
WHEN NO_DATA_FOUND THEN
-- handle exception
WHEN OTHERS THEN
-- handle exception
END;
/
或keyup
事件验证密码的长度:
input
&#13;
$('#txtpass2').on('blur', function() {
var shouldShowAlert = ($(this).val().length < 6);
$("#passAlert2").toggle(shouldShowAlert);
});
&#13;
下面是jquery方式:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
use oninput<input type="password" id="txtpass" value="" oninput="validatePass(this)"/>
<span id='passAlert'>Length is too short</span>
<script>
function validatePass(target) {
var shouldShowAlert = (target.value.length < 6);
$("#passAlert").toggle(shouldShowAlert);
}
</script>
<br/>
use onblur<input type="password" id="txtpass2" value=""/>
<span id='passAlert2' style="display: none;">Length is too short</span>