我将_blank
放在此搜索脚本中的哪个位置?
<script>
$(document).ready(function(){
$('#txtSearch').autocomplete({
source: "post_search.php",
minLength: 2,
select: function(event, ui) {
var url = ui.item.id;
if (url != '#') {
location.href = url
}
},
open: function(event, ui) {
$(".ui-autocomplete").css("z-index", 1000)
}
})
});
</script>
答案 0 :(得分:0)
您可以尝试使用location.href
而不是window.open
。您的代码应如下所示:
window.open(url,'_blank');