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,

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

$("#suggest1").focus().autocomplete(cities);

to

$("#suggest1").focus().autocomplete('data.php');

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">
<html>
<head>
<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, '');
	}
	
	$("#suggest1").focus().autocomplete(cities);		
});

</script>
</head>

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

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

<script type="text/javascript">alert('<?php echo $somethingfromDatabase; ?>');</script>

sir, where will i insert this line in my bunch of codes??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.