I have an autocomplete text box that needs to respond to 2 events:
- When the user is done typing something in the text box (I'm currently using
focusoutto assume when the user is done typing. So, if a user tabs out of a text box, it means the user is done typing.) - When the user selects an item in the autocomplete list of values (I'm using autocomplete's
selectevent to determine that)
The Problem:
When the user selects an item in the autocomplete list of values, the chain of event is such that focusout is called first, then the select. When in focusout, I only have access to what the user typed, not what the user selected om the autocomplete list of values -- and that's what I actually need. How do I solve this problem?
Steps to Reproduce the Problem:
- In the text box, type the letter
a - Select
ActionScriptfrom the autocomplete list of values Observe console.debug messages:
focusout event called a select event called ActionScript
Here's the code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<title>Data Matching</title>
</head>
<body>
<form>
<input id="1" type="text"></input>
<input id="2" type="submit"></input>
</form>
<script type="t