Solved

HTML Special characters not working with JQuery autocomplete

Posted on 2015-01-26
2
808 Views
Last Modified: 2015-01-29
Hi I am having trouble displaying HTML special characters in JQuery autocomplete. for example & appears as & and I want it to appear as &

Here is my code (I am looking for a Javascript or JQuery solution):

<script type="text/javascript">
	
	$(function() {
       
		$( ".auto" ).autocomplete({
		  source: function( request, response ) {
			$.ajax({
			  url: "./auto_search.php?type="+$( ".auto" ).attr("rel"),
			  dataType: "jsonp",
			  data: {
				q: request.term
			  },
			  success: function( data ) {
				response( data );
			  }
			});
		  },
		  minLength: 3,
		  open: function() {
			$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
		  },
		  close: function() {
			$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
		  }
		});
	  });
</script>

Open in new window

0
Comment
Question by:jwleys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 40571453
Hi,
either you use this mentioned extension:
https://github.com/scottgonzalez/jquery-ui-extensions/blob/master/src/autocomplete/jquery.ui.autocomplete.html.js
(mentioned on the official jQuery UI API doc)
or some overides like this:
http://jsfiddle.net/55hu9yx7/

This will HTML decode the values.

HTH
Rainer
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question