autocomplete and masked input
Hello,
I'm trying to add autocomplete on a masked input based on another input field, the code looks like this :
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="../lib/jquery.js"></script>
<script type='text/javascript' src='../jquery.autocomplete.min.js'></script>
<script src="../jquery.maskedinput-1.2.2.min.js" type="text/javascript"></script>
<script type="text/javascript" >
$().ready(function() {
$("input:input.noss").mask("9 99 99 99 999 999 99");
$('#noss').blur(function() {
tab = [];
tab[0]=$(this).val();
$('#noss_enf_1').unbind().autocomplete(tab,{
minChars:0,
width: 450});
$('#noss_enf_2').autocomplete(tab,{
minChars:0,
width: 450});
});
});
</script>
<link rel="stylesheet" type="text/css" href="main.css" />
<link rel="stylesheet" type="text/css" href="../jquery.autocomplete.css" />
</head>
<body>
<p><input name="noss" id="noss" class="noss"/></p>
<br /><br />
<p><input name="noss_enf_1" id="noss_enf_1" class="noss"></p>
<p><input name="noss_enf_2" id="noss_enf_2" class="noss"></p>
</body>
</html>
If I don't unbind my field first, autocomplete doesn't work - and if I do, of course, the mask is gone (and it doesn't work either if I try to apply the mask after adding autocomplete).
Can you get both behaviours on a single field ? If so, what am I doing wrong ?
Thanks,