我在表格中填写了4个字段(姓名,电话,课程,中心)。第五场是“滚动”。当我填写4个字段时,如何在没有表单提交的情况下生成滚动, 我想生成这样的卷 我的4字段文字如下 名称 - 杰克,电话1234567890,当然,电脑,中心-010 填写此字段后,生成滚动和打印第5个字段,不提交表单 无障碍Jac890Com10
答案 0 :(得分:-1)
您可以在输入中附加onchange
个事件。
<form method="post" action="">
<input type="text" name="name" id="name" onchange="my_validate_func()">
<input type="text" name="phone" id="phone" onchange="my_validate_func()">
<input type="text" name="course" id="course" onchange="my_validate_func()">
<input type="text" name="center" id="center" onchange="my_validate_func()">
<input type="text" name="roll" id="roll">
<button type="submit">Submit</button>
function my_validate_func (){
if($('#name').val()!="" && $('#phone').val()!="" && $('#course').val()!="" && $('#center').val()!=""){
$.ajax({
url:'your_url',
success: function(response){
$('#roll').val(response.roll_num);
}
});
}
}