两个autoComplete输入jQuery之后的链接

时间:2013-07-11 03:17:18

标签: jquery input autocomplete hyperlink combinations

我正在网上京都巴士路线。所以我在我的代码中开始和结束autoComplete。我的目标是编写识别主要停靠点组合并链接到(或播放)新html文件的代码。

这是我的HTML代码。 .......

<body>
<div id = "buttons">
<h1> Kyoto Bus Map</h1>
<label for="autocomplete">start </label>
<input id="autocomplete" placeholder="where is your closest bus station?" />

<label for="autocomplete1">end</label> 
<input id="autocomplete1" placeholder="where would you like to go?" /> 
</div>

<script>
var source = [ {label: "kyoto Station"},
               {label: "Gion"},
               {label: "Kyoto Tower"}]; /*I also want my start input to wait until end input is filled.*/

var source1 = [ {value: "kyoto.html", label: "kyoto Station"},
           {value: "gion.html", label: "Gion"},
           {value: "tower.html", label: "Kyoto Tower"}];



$(document).ready(function() {
$("input#autocomplete").autocomplete({
    source: source,
    select: function( event, ui ) { 
        window.location.href = ui.item.value;
    }
});
});


$(document).ready(function() {
$("input#autocomplete1").autocomplete({
    source: source1,
    select: function( event, ui ) { 
        window.location.href = ui.item.value;
    }
});
});

</script>
</body>
........

谢谢!!!

0 个答案:

没有答案