Solved

HTML Special characters not working with JQuery autocomplete

Posted on 2015-01-26
2
638 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
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
 

Author Closing Comment

by:jwleys
ID: 40578478
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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)

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now