views:

150

answers:

0

Hi, I m using JQuery in my application . I am trying to implement autocomplete feature on my text boxes. I m having a code like below. Here each time applyAutoComplete funcion is called i have to make the autocomplete ready for the text boxes passed along with the previously active text boxes.

Now what is happening is, the autocomplete on the first set of text boxes(i.e the first call to applyAutoComplete with the text boxes) are working but not the later called text boxes. While debugging i found that for the later text boxes the keyup event handler is getting out of scope.

Its urgent ... Any clue?

Or even new idea will do.

function applyAutoComplete(textboxObjList) {

    //I am adding little wrapper around the input box for my autocomplete to work.
    //From <input type='textbox' /> ---->
    //To <Div id='s1' _autocomplete='y' _filterName='f1'><input id='i1' class='activeAutocomplete' /></div>      and then catching the keyup.
    //Catch the events for all the autocomplete required text boxes.

     $("Div[_autocomplete=y] input")
        .keyup(function(event) {
              alert('s');                               
        });

    }

function Edit()
{
  //Some code

 ///some code to generate elementList
  applyAutoComplete(elementList);

  //some other code
}

function Add()
{
  //Some code

 ///some code to generate elementList
  applyAutoComplete(elementList);

  //some other code
}

Thanks n Regards Subrat.