jake
jake

Reputation: 317

jQuery auto complete adding escape characters to the results ater arrow up or down

Have a look here:

http://jsfiddle.net/zK3Wc/27/

Does anyone have a quick and simple fix for this?

Basically the html escape characters are being added in the input field if the user arrows up, or down.

Upvotes: 0

Views: 1004

Answers (2)

jake
jake

Reputation: 317

Fixed!

http://jsfiddle.net/zK3Wc/32/

With the help of some googling and another S.O. Question; under the "focus" object, I added this:

        $( ".project" ).val( ui.item.label );
        function decode(input){
          return $('<div/>').html(input).text();
        }
        $(function(){
          $('.project').keydown(function(){
            $($(this)).val(decode($($(this)).val()));
          });
        });

Hopefully this helps anyone else that runs into this problem!

Tested in IE 7,8,9 FF, Chrome and Safari.

Upvotes: 0

Micah Henning
Micah Henning

Reputation: 2185

In your projects array, you have unicode character references. If your website is encoded as UTF-8, this may not be necessary.

See here: http://jsfiddle.net/zK3Wc/28/

Upvotes: 1

Related Questions