1
我想在jQuery的自动完成搜索文本之前添加图像图片添加到jQuery的自动完成搜索
我用下面的代码,它的工作原理,但没有图像显示,所以我怎样才能使图片中的文字显示之前
$(document).ready(function() {
$("input#autocomplete").autocomplete({
source: [{
value: "NYC",
img: 'http://www.uidownload.com/files/974/95/760/new-york-icon.png',
url: 'http://www.example.com'
}, {
value: "LA",
img: 'https://www.shareicon.net/data/128x128/2015/09/17/642167_cinema_512x512.png',
url: 'http://www.example.com'
},
{
value: "Peru",
img: 'http://tvmak.com/img/alsatm.jpg',
url: 'http://www.example.com'
}
],
select: function(event, ui) {
window.location = ui.item.url;
}
});
});
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<search style="font-size:62.5%;">
<input id="autocomplete" />
</search>
这工作:http://jsfiddle.net/mplungjan/mud9L7v0/ – mplungjan
它需要打开链接时,点击 – arpo
将href添加到一个 – mplungjan