在jquery中使用.focus()后在DIV显示数据
可以说我的表格如下:
OK NG i'm using barcode scanner for input `serial`, i want do like this:
- 在下拉列表中选择
model
- 选择
model
后,将焦点设置为#serial
以便在文本字段中显示数据 - 扫描后的数据显示在文本字段内
- 填充文本字段后,在
DIV
显示DB中的一些数据
这就是我所拥有的:
$("#model").click(function() { var data=$("#model").val(); $("submit input:text.eq(0)").focus(); var str=data; var matches=str.match(/[TEJUG2]\D*D/i); $.ajax({ type:"post", url:"process1.php", data:"packing="+matches+"&action=packcond", cache:false, async:false, success: function(res){ $('#value').replaceWith( "" + res + "
" ); } }); });
但我认为这不能解决问题。你能帮助我吗? 🙂
$("#model").change(function() { $('#serial').focus(); }); $('#serial').change(function(){ var data=$("#model").val(); var str=data; var matches=str.match(/[TEJUG2]\D*D/i); $.ajax({ type:"post", url:"process1.php", data:"packing="+matches+"&action=packcond", cache:false, async:false, success: function(res){ $('#value').replaceWith( "" + res + "
" ); } }); });