hi guys, i already have the code for autocomplete..
what i want is that whenever the user inputs a certain character in the textbox the letters in the autocomplete should be emphasized, let's say, highlighted or bold.

see attached example,

Attachments Image8.png 0.44 KB
6 Years
Discussion Span
Last Post by xuexue

sir i already got one and it's working just fine..now my question is taht..
is it possible that the data will be coming from the database instead of it stored in
a javascript file? if so, how is it possible??

this is my code. they say also that it is possible. i've tried changing this line




but the question is, how could i code the sql statement in the php??

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<script type="text/javascript" src="./lib/jquery.js"></script>
<script type='text/javascript' src='./lib/jquery.bgiframe.min.js'></script>
<script type='text/javascript' src='./lib/jquery.ajaxQueue.js'></script>
<script type='text/javascript' src='./lib/thickbox-compressed.js'></script>
<script type='text/javascript' src='jquery.autocomplete.js'></script>

<script type='text/javascript' src='localdata.js'></script>

<link rel="stylesheet" type="text/css" href="./css/main.css" />
<link rel="stylesheet" type="text/css" href="./css/jquery.autocomplete.css" />
<link rel="stylesheet" type="text/css" href="./css/thickbox.css" />
<script type="text/javascript">
$().ready(function() {

	function formatItem(row) {
		return row[0] + " (<strong>id: " + row[1] + "</strong>)";
	function formatResult(row) {
		return row[0].replace(/(<.+?>)/gi, '');


	<form autocomplete="off">
			<label>Single City (local):</label>
			<input type="text" id="suggest1" />

yes, it is possible by using PHP inside a Javascript. for example

<script type="text/javascript">alert('<?php echo $somethingfromDatabase; ?>');</script>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.