[英]focus on newly created input field on blur
I have a form that creates fields based on input data. 我有一个基于输入数据创建字段的表单。 When a user fills in #invId, i need to create the next field #invIdDate and then focus on it.
当用户填写#invId时,我需要创建下一个字段#invIdDate,然后专注于此。
I have tried this: 我已经试过了:
$(document).on('blur','#invId',function(){
$('#invDateField').html("<input type='text' id='invDate' name='invDate' placeholder='Invoice Date'>");
setTimeout(function(){
$('#invDate').focus();
}, 50);
});
also tried: 还尝试了:
$('body').on('blur','#invId',function(){
$('#invDateField').html("<input type='text' id='invDate' name='invDate' placeholder='Invoice Date'>");
$('#invDate').focus();
});
// note: #invDatefield is the id of a cell in table.
the result is when i tab off #invId, i goto chrome url field. 结果是当我关闭#invId时,我转到chrome url字段。
我在附加输入时遇到问题,请尝试在附加输入后找到它:
$('#invDateField').find('input').focus();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.