在1表单上创建多个自动填充文本

时间:2014-04-06 06:54:30

标签: javascript jquery

如何将此自动完成java代码更改为更灵活,并且可以在一个表单内的多个inputtext中使用(仅在同一表单上) 例如: 1. inputText首先从表城市检索数据 2. inputText从另一个表中检索数据

请帮助我,我是java的新手,这是我的第一个项目 我之前非常感谢你的帮助

这是代码:

function suggest(inputString) {
    if (inputString.length == 0) {
        $('#suggestions').fadeOut();
    } else {
    $('#country').addClass('load');
        $.post("autosuggest.php", {
            queryString: ""+inputString+""
        }, function (data) {
            if (data.length > 0) {
                $('#suggestions').fadeIn();
                $('#suggestionsList').html(data);
                $('#country').removeClass('load');
            }
        });
    }
}
function fill(thisValue) {
    $('#nama').val(thisValue);
    setTimeout("$('#suggestions').fadeOut();", 100);
}
function fill2(thisValue) {
    $('#kode').val(thisValue);
    setTimeout("$('#suggestions').fadeOut();", 100);
}

0 个答案:

没有答案
相关问题