1

I am using the autocomplete to display items that contain html markup such as T128 The first script will display the autocomplete list, but not as html..it will display T128 in the list, but I can select the item:

    var createAutocomplete = function () {
    var $input = $(this);
    var options = {
        source: $input.attr("data-jax-autocomplete"),
        minLength: 3
    };
    $input.autocomplete(options)
    };

I found a fix that will render the html markup in the autocomplete list, but after changing the script, I found that I can no longer select an item on the list:

    var createAutocomplete = function () {
    var $input = $(this);
    var options = {
        source: $input.attr("data-jax-autocomplete"),
        minLength: 3
    };


    $input.autocomplete(options).data("autocomplete")._renderItem = function (ul, item) {
        return $("<li></li")
          .append("<a>" + item.label + "</a>")
          .appendTo(ul);
    };

};
2
  • what happens when you try to select it? Commented Feb 21, 2013 at 17:35
  • Nothing...that is the question that I am asking. In the first example I could select an item from the autocomplete list and it would be displayed in the input. In the second example when I click on an item in the autocomplete list nothing happens Commented Feb 21, 2013 at 19:08

1 Answer 1

1

I was able to solve this by using the jquery.ui.autocomplete.html.js extension by Scott

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.