• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

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

1 Solution
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.

Join & Write a Comment

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now