开发者

jQuery autocomplete - result link

I have autocomplete returning:

   $("#_results").autocomplete({
    source: data1,
    minLength: 0,
    selectFirst: true,
    select: function(event, ui) {
     if(event.keyCode == 13){
      window.open(ui.item.url);
     }
    }     
   }).data( "autocomplete" )._renderItem = function( ul, item ) {
   if(item.label == "No results found"){
    return $( "<li></li>" )
    .data( "item.autocomplete", item )
    .append( "<a href=\'#\' title='No results found' target=\'_self\'>" + "<span class='apptitle'>" + item.title + "</span>" + "<br />" + "<span class='descrip'>" + item.description + "</span>" + "</a>")
    .appendTo( ul )      
   }      
   else if(item.support_url != ""){
    return $( "<li></li>" )
    .data( "item.autocomplete", item )
    .append( "<a href=\'" + item.url + "\' title='Click here to launch' target=\'_blank\'>" + "<span class='apptitle'>" + item.title + "</span>" + "<br />" + "<span class='descrip'>" + item.description + "</span>" + "<a href=\'" + item.support_url + "\' target=\'_blank\'><img src=\'http://supportcentral.ge.com/images/HELP_FORMS.GIF\' /><span class=\'supportText\'>Please click here for support</span></a>" + "</a> <hr width='80%' align='center'>")
    .appendTo( ul )
   }else{
    return $( "<li></li>" )
    .data( "item.autocomplete", item )
    .append( "<a href=\'" + item.url + "\' title='Click here to launch' target=\'_blank\'>" + "<span class='apptitle'>" + item.title + "</span>" + "<br />" + "<span class='descrip'>" + item.description + "</span>" + "<a href=\'http://supportcentral.ge.com/cases/case_log_quickcase.asp?prod_id=139545&cat_id=92831\'><img src=\'http://supportcentral.ge.com/images/HELP_FORMS.GIF\' /><span class=\'supportText\'>No support URL was provided. Please suggest one.</span></a>" + "</a> <hr width='80%' align='center'>")
    .appendTo( ul )     
   }
  };

I don't know what I changed but now when I click the result it will not trigger the href. I can right click on it and pick "open new window/tab" and that works. Also pressing enter triggers the url to be opened. But clicking on it with the mouse does not do anything other than hide the list (as though it did what it was suppose to). When I look at the HTML it looks correct to me:

开发者_Python百科
<a target="_blank" title="Click here to launch" href="some_url_cant_post_more_than_1_on_here" class="ui-corner-all" tabindex="-1"><span class="apptitle">Some Title</span><br><span class="descrip">Description of App</span></a>

Anyone have any ideas?


Turned out the latest version of jquery ui min broke the click. I reverted back to an older version.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜