你好我需要在用户切换到另一个html input type='text'后自动触发输入按钮。 我需要这样做,以便我可以验证表单。
这里是我的代码:
<input type="text" class="form-control input-sm" name="student_lastname" placeholder="Last Name" pattern="[A-Za-z].{1,}" title="Only Letters are accepted and more than 1 letter" required>我需要错误title="Only Letters are accepted and more than 1 letter"弹出时,用户完成键入框
现在这是我的代码看起来像
hello guys i need to automatic trigger the enter button after the user switch to another html input type='text'. i need to do this so that i can validate the form.
here is my code:
<input type="text" class="form-control input-sm" name="student_lastname" placeholder="Last Name" pattern="[A-Za-z].{1,}" title="Only Letters are accepted and more than 1 letter" required>i need the error title="Only Letters are accepted and more than 1 letter" to pop up when the user is finished typing to the box
right now this is what my code looks like
最满意答案
onblur是完美的解决方案,专为用户离开输入字段时制定。 只要做这样的事情:
对于HTML:
<input type="text" onblur="validate()" />对于JS:
function validate() { // This is how you automatically make them click the Enter button: enterButton.click(); }onblur is the perfect solution, and was made specifically for when the user leaves an input field. Just do something like this:
For HTML:
<input type="text" onblur="validate()" />And for JS:
function validate() { // This is how you automatically make them click the Enter button: enterButton.click(); }更多推荐
type,需要,代码,user,letter,电脑培训,计算机培训,IT培训"/> <meta name="descri
发布评论