选择链接到页面的JQuery自动完成

时间:2013-12-12 13:49:46

标签: javascript jquery autocomplete

我有以下jQuery自动完成

   $(function() {
    $("#my_ac").autocomplete({
        source: [
            {
                value: "/Tom-Hanks",
                label: "Tom Hanks",
                description: "Actor",
                image: "hanks.png"
            },
            {
                value: "/Termionator-2",
                label: "Termionator 2",
                description: "Movie",
                image: "terminator.png"
            }
        ],
        minLength: 1
    }).data( "autocomplete" )._renderItem = function( ul, item ) {
        var inner_html = '<a><div class="list_item_container"><div class="image"><img src="' + item.image + '"></div><div class="label">' + item.label + '</div><div class="description">' + item.description + '</div></div></a>';
        return $( "<li></li>" )
            .data( "item.autocomplete", item )
            .append(inner_html)
            .appendTo( ul );
    };
});

选择标签时,我想加载一个新页面网址,即:选择“Tom Hanks”链接到页面/Tom-Hanks

0 个答案:

没有答案