OnKeyUp多个文本框

<script type="text/javascript">
// AJAX call for autocomplete 
$(document).ready(function(){

$( "#datepicker" ).datepicker({
    changeMonth: true,//this option for allowing user to select month
    changeYear: true //this option for allowing user to select from year range
    });

$("#script_name").keyup(function(){
    $.ajax({
    type: "POST",
    url: "readCountry.php",
    data:'keyword='+$(this).val(),
    beforeSend: function(){
    $("#script_name").css("background","#FFF url(LoaderIcon.gif) no-repeat 165px");
    $("#industry_name").css("background","#FFF url(LoaderIcon.gif) no-repeat 165px");
    },
    success: function(data){

    $("#industry_name_box").show();
    $("#industry_name_box").html(data);
    $("#industry_name").css("background","#FFF");


    $("#script_suggestion_box").show();
    $("#script_suggestion_box").html(data);
    $("#script_name").css("background","#FFF");



    }
    });
});

});
//To select country name
function selectCountry(val) {
$("#script_name").val(val);
$("#script_suggestion_box").hide();
}

function selectCountry1(val) {
$("#industry_name").val(val);
$("#industry_name_box").hide();
}
</script>

What I want is:
when somebody enters text in one field first, autocomplete feature is there which I managed to do.
Then according to that field the corresponding data is shown in another textbox, as we do in state, city in php in select box, but here I want it in textbox.

Edit These are two HTML snippet which where posted in a comment:

<input name="textfield" type="text" id="script_name" placeholder="Script Name" style="background-color:#fff; padding:5px; color:#000;"></td> <input name="textfield2" type="text" id="textfield2" value="Sector" style="background-color:#fff; padding:5px; color:#000;"></td>
<input name="textfield" type="text" id="script_name" placeholder="Script Name" style="background-color:#fff; padding:5px; color:#000;"> <input name="textfield2" type="text" id="textfield2" value="Sector" style="background-color:#fff; padding:5px; color:#000;">
查看全部
weixin_33698823
weixin_33698823
2017/05/09 05:33
  • autocomplete
  • php
  • ajax
  • javascript
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

0个回复