Append one link to jquery ui autocomplete

橙三吉。 提交于 2019-12-25 01:33:05

问题


what i want to achieve is, that when the autcompletion list is rendered, an additional div with one link is appended to the resultlist. somehow this is not working for me. i've tried

    $(".ui-autocomplete").append('<div style="border:1px solid red"><a href="#">Click me to get in contact</a></div>');

but that's not working. If i do

    $(".ui-autocomplete").append('<p>Ramo</p>');

then i get a red border around the ul element of the autocomplete box.That's fine, so i thought a simple append should work.

Any ideas for that issue?

Best regards, Ramo


回答1:


You could do

  $( "#tags" ).autocomplete({
        source: availableTags,
        open: function(){
            $(".ui-autocomplete").append('<li style="border:1px solid red"><a href="#">Click me to get in contact</a></li>');
        }
    });

fiddle here http://jsfiddle.net/uuPGq/



来源:https://stackoverflow.com/questions/8879930/append-one-link-to-jquery-ui-autocomplete

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!