在jquery中使用.focus()后在DIV显示数据

可以说我的表格如下:

   
OK NG i'm using barcode scanner for input `serial`, i want do like this:
  1. 在下拉列表中选择model
  2. 选择model后,将焦点设置为#serial以便在文本字段中显示数据
  3. 扫描后的数据显示在文本字段内
  4. 填充文本字段后,在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 + "
" ); } }); });