简体   繁体   中英

Hyperlink of text suggestion

I have a auto complete input filed, I want to set hyperlink whenever we select suggested input. suggestion is working fine but i unable to make it hyperlink.

My code is given below :

<script src="jquery.autocomplete.js" type="text/javascript"></script>
 <link rel="stylesheet" href="jquery.autocomplete.css"> 

<input type="text" value="" class="form-control" id="auto1" name="category" >


<script>
var cat= [
    '<?php 
$blog_cat="select * from category order by cat_name asc";
$blog_query=mysql_query($blog_cat);
 while($data=mysql_fetch_assoc($blog_query)){


     echo $data['cat_name'];
     echo "','";
 }?>',
];
$('#auto1').autocomplete({
    source:[cat]
});


</script>

source:[cat]应该是source:cat ,你需要传递给它一个数组,而不是一个数组数组。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM