auto complete using jquery...

Hi, I have an autocomplete code as attached. The problem is that it picks up the match anywhere in the string. How can I change the code to pick the match staring from the beginning of the string?

Eg; search 11 needs to pick up 11237 and not 198112. Thank you for the help.

<script type="text/javascript">
$().ready(function() {
	$("#account").autocomplete("account.php", {
		width: 260,
		matchContains: true,
		mustMatch: true,
		selectFirst: true
	$("#account").result(function(event, data, formatted) {

Open in new window

Who is Participating?
leakim971Connect With a Mentor PluritechnicianCommented:
you have nothing to do with Javascript. you must work on your script "account.php"

in your SQL query, instead : '%$q%'
use : '$q%'
aej1973Author Commented:
yes, that worked. Thank you very much.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.