jquery - Positioning input box of tokeninput -
im kinda stuck jquery tokeninput, i've hacked works great adding freetags database , return id , name new tag. have problems, positioning input auto-complete area, input area "behind" tokens, want in front of tokens.
i appreciate if can give me helping hand :)
if of help, here code far.
$("#xxx").tokeninput("/get-tags", { theme: "facebook", noresultstext: "hit enter add", searchingtext: "searching", placeholder: 'tags', freetagginghint: true, propertytosearch: 'name', allowfreetagging: true, tokenformatter: function(item) { return "<p name=\"tags[]\" value=\""+item.id+"\">"+item.name+"</p>"; }, onfreetaggingadd: function (item) { $.ajax({ type: "post", url: "/dev/ajax/add-tag/", data: { tag: item, uid: 1 }, success: function(data) { console.log(data); jquery("#tags").tokeninput("add", {id: data, name: item}); } }); } }); });
i believe problem may tokenformatter
function. various parts of jquery library rely on tokens being <li>
's - found when wrapped tokens in div
's.
as easiest fix, wrap tokens in <li>
's, below.
tokenformatter: function(item) { return "<li><p name=\"tags[]\" value=\""+item.id+"\">"+item.name+"</p></li>"; },
if messes layout or something, you'll need go through change number of references in library itself, bigger job.
Comments
Post a Comment