[jQuery] Autocomplete + click : What do i do wrong here ?

[jQuery] Autocomplete + click : What do i do wrong here ?


Hello everybody,
I am brand new using jquery and have some problems !
I have to say I am not un professional so be indulgent with my code !
Could someone tell me if there some obvious mistake in this script :
<script type="text/javascript">
$(document).ready(function(){
        $(".txtSerial").click(function () {
            $(this)
                .autocomplete("./serieComplete.php", {max: 10, scrollHeight: 220,
mustMatch: true})
                    .result(
                        function(){
                            var code = $(this).val();
                            var inindex = ($("acronym + input").index(this));
                            $(""+"acronym + input:lt("+inindex+")")
                                .filter(function (index) {return $(this).val() == "";})
                                .val(code)
                                .css("backgroundColor","yellow");
                     }
);
                }
);
        }
);
</script>
The structure of the page structure is like this (multiplied by n)
<div id="container_3679">
<table>
<tr>
<td>
<acronym title="#3679">
<a target="fullpreview" href="/php/pages/
downloadjpeg.php?id=3679" target="_blank"><img id="img_3679"
src="http://img3-dev.lamapix.com/php/viewjpeg.php?id=3679&mode=p"
style="border:1px solid black;"></a>
</acronym>
</td>
</tr>
<tr>
<td align =center valign=top>
<acronym></acronym>
<input class="txtSerial" name="myInput_3679"
id="myInput_3679" type="text" value="" onfocus="var
o=document.getElementById('myInput_3679').value; if(o.length>0)
highlightCurrentCode(imgIds, document.getElementById
('myInput_'+3679).value);">

<a id="more_3679" onclick="var
o=document.getElementById('myInput_3679').value; if(o.length>0){popup
('serie_popup.php?code='+o,350,110)};"
style="cursor:hand;cursor:pointer;text-
decoration:none;display:none;"><b>Prix / email ...</b></a>
<img src="/img/delete.png" valign="absmiddle"
border="0" onclick="if(confirm('sure?')) {document.getElementById
('container_3679').style.display='none';document.getElementById
('myInput_3679').value = 'deleted';}">
<input type="hidden" id="collid_3679"
onfocus="(imgIds, document.getElementById('myInput_'+3679).value);">
</td>
</tr>
</table>
</div>
Everyting works fine with this script but it's make my page very haevy
as i have to recreate the script for each "node". which i would like
to avoid with the previous script :
$("#myInput_3679")
            .autocomplete("./serieComplete.php", {max: 10, scrollHeight: 220,
mustMatch: true})
                            .result(
                                function(){
                                    $("#more_3679").show();
                                    var code = $(this).val();
                                    var inindex = ($("acronym + input").index(this));
                                    $(""+"acronym + input:lt("+inindex+")")
                                        .filter(function (index) {return $(this).val() == "";})
                                        .val(code)
                                        .css("backgroundColor","yellow");
                                }
                            )
                        ;
Thank you very much for any help
Jean