开发者

jQueryUI autocomplete not working

开发者 https://www.devze.com 2023-01-06 21:41 出处:网络
I was using this code earlier today and it worked fine, then I apparantly changed something and it doesnt work. ive tried reinstalling jQueryUI but it doesnt help.

I was using this code earlier today and it worked fine, then I apparantly changed something and it doesnt work. ive tried reinstalling jQueryUI but it doesnt help.

<script type="text/javascript">
$(function() {
    function loadpage(webpage) {
        window.location.replace( webpage );
    }

    $("#searchform").autocomplete({
        source: "search.php",
        minLength: 2,
        select: function(event, ui) {
            loadpage(ui.item ? ("http://www.tf2heatmaps.net/maps/" + ui.item.value + "/"));
        }
    });
});
</script>
                <div class="ui-widget">
   开发者_StackOverflow             <label for="searchform">Search: </label>
                <input id="searchform" class="textbox">
                </div>

search.php returns valid JSON so I don't believe the problem is there.


You should be getting a missing : in conditional expression as the parameter you give to loadpage is an incomplete shorthand if

In other words you are missing the else part..

0

精彩评论

暂无评论...
验证码 换一张
取 消