如何验证请在bootstrap中选择下一个文本框时输入第一个字段 [英] How to validate please enter first field on selection of next text box in bootstrap
本文介绍了如何验证请在bootstrap中选择下一个文本框时输入第一个字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用aspx页面的主页
我的设计是在Bootstrap所以当你选择填充数据的第二个字段时请你帮助我,然后它需要请填写第一个字段
请帮帮我
我尝试了什么:
i我正在使用aspx页面的主页
我的设计是在Bootstrap所以当你选择填充数据的第二个字段然后它需要请填写时请帮助我第一场$
请帮助我
i am using master page with aspx page
and my design is in Bootstrap so can you please help me when i choose second field for fill data then it require please fill first field in
please help me
What I have tried:
i am using master page with aspx page
and my design is in Bootstrap so can you please help me when i choose second field for fill data then it require please fill first field in
please help me
推荐答案
tr
tr
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
</head>
<body>
<script>
function funcheck(txt) {
var key = parseInt(txt.getAttribute('key'));
var txts = document.getElementsByClassName('txtclass');
for (var i = 0; i < txts.length; i++) {
var attr = txts[i].getAttribute('key');
if (attr) {
if (attr == key) {
('。temp'+ i).remove();
if(txts [i] .value =='')
('.temp' + i).remove(); if (txts[i].value == '')
(txts [i])。after('必填字段!! ')
}
}
}
}
< /脚本>
< input key =1class =txtclasstype =textonblur =funcheck(this); return false; id =txt1/> < br />
< input key =2class =txtclasstype =textonblur =funcheck(this); return false; id =txt2/>< br />
< input key =3class =txtclasstype =textonblur =funcheck(this); return false; id =txt3/>
< / body>
< / html>
(txts[i]).after('mandatory field!!') } } } } </script> <input key="1" class="txtclass" type="text" onblur="funcheck(this); return false;" id="txt1" /> <br /> <input key="2" class="txtclass" type="text" onblur="funcheck(this); return false;" id="txt2" /><br /> <input key="3" class="txtclass" type="text" onblur="funcheck(this); return false;" id="txt3" /> </body> </html>
演示: - JSFiddle [ ^ ]
这篇关于如何验证请在bootstrap中选择下一个文本框时输入第一个字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文