?
Solved

HTML Special characters not working with JQuery autocomplete

Posted on 2015-01-26
2
Medium Priority
?
916 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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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)
Suggested Courses

649 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