Attaching an image to jQuery's autocomplete -


I'm having some difficulty adding the image to jQuery's auto-complete widget. I'm a lot new for jquery so I apologize for the simplicity of the problem. The function Belbo is what I am using, but syntactically it is wrong (throwing firebug error "type error: $ (...). Autocomplete (...). Data (...) is undefined "), But I do not see where it is wrong. I can not even get on its functionality aspect! Any guidance would be helpful are already a number of questions on this tpoic but unfortunately I can not do anything because of my inexperience with could not manipulate messages to fit your case (mainly because jQuery).

The way of avatar is "../avatars/user_id/user_id_thumbnail.jpeg" where user_id = an integer

  $ (function () {$ ("#main_search" Data ("Autocomplete") ._RenderItem = function (ul, item) {var pic_path = ' & Lt; img src = "../ avatars / '+ item.value +' / '+ item.value +' _thumbnail.jpeg" & quot;; Return $ ("
  • "). Data ("Item.autocomplete", item) .append ("& lt; a & gt;" + pic_path + item.label + "& lt; / a & gt;") attached (ul);};});
  • OK, by testing and error and reviewing the questions, this "UI" To complete autocomplete .... Such as ..

      $ (function () {$ ("#main_search"). Autocomplete ({Mainlangha: 2, Source: '... / AJAX / Search.php ', minLength: 1}) .data ("ui-autocomplete") ._renderitem = function (ul, items) {var pic_path =' & lt; img src = "../ avatars / ' + item.id + '/' + Item.id + '_thumbnail.jpeg "& gt;'; console.log (pic_path); return $ (" & lt; li & gt; ") Kdeta (" item.autocomplete ", Item) .append (" & lt; a & gt; "+ pic_path + item.label +" & lt; / a & gt; ") .appendTo (UL);};});  

    Comments

    Popular posts from this blog

    java - org.apache.http.ProtocolException: Target host is not specified -

    java - Gradle dependencies: compile project by relative path -

    ruby on rails - Object doesn't support #inspect when used with .include -