[jQuery] Dynamic Inputs and having JS work

[jQuery] Dynamic Inputs and having JS work


Hello
I am currently using a autocomplete plugin which is working on a
single static input. I currently have jQuery creating new inputs and
I'd like to have the autocomplete on work then as well. Im not too
familiar with javascript or jQuery but, I think since the inputs are
created after the "$().ready(function()", the autocompleter doesnt
work.
I have figured out a way to make it work but I dont think it is the
best way. Here is what I am doing:
----------------------------------------------
$().ready(function() {
    $(".inputs").autocomplete("ajax/inputs_query/", {
        width: 360,
        selectFirst: false,
        formatItem:formatItem
    });
});
----------------------------------------------
then within the function that appends the inputs, right after the
append. I just have it do (again):
----------------------------------------------
    $(".inputs").autocomplete("ajax/inputs_query/", {
        width: 360,
        selectFirst: false,
        formatItem:formatItem
    });
----------------------------------------------
Is there a better way to this?
Thanks