简体   繁体   English

javascript 文本框数组并获取值并关注特定字段

[英]javascript text box array and get values and focus on particular field

<input type="textbox" name="Tue[]" />
<input type="textbox" name="Tue[]" />
<input type="textbox" name="Tue[]" />
<input type="textbox" name="Tue[]" />

am entering invalid values in textbox 3, how to alert message and focus particularly into textbox 3在文本框 3 中输入无效值,如何提醒消息并特别关注文本框 3

just add the following function to the onblur event of the textbox只需将以下 function 添加到文本框的 onblur 事件中

function validateText(event){
var tar_ele = $(event.target);
if(tar_ele.val() is not valid)
tar_ele.focus();

}

<input type="text" name="Tue[]" onblur="validateText(event)"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM