I've create a jQuery event for .addrow Button, once we click it, that
will add new row to the table, there are couple of formfield with
suggestbox will also clone within the same row.  As the formfield
input id will also clone, how can I pass the identity to jQuery
jsonSuggest function, I can get all the value in next by String foods
[] = req.getParametervalues(foods).....  Please help, thank you very
much.

$(document).ready(function() {
    $('#form1').validationEngine();
    var newRowNum = 0;
    $('.addRow').click(function(){
      var $newTr = $('#tb1 tbody>tr:last').clone(true);
      newRowNum +=
1;                                                              <==
counter of the rows
      $newTr.find('input:even').attr('id', function(){
      $('').jsonSuggest
(                                                                 <==
this part
        function(text, wildCard, caseSensitive, notCharacter) {
          rez = $.ajax({
          type: 'GET',
          url: 'getFoodJSON.jsp',
          data: 'foods=' + text,
          dataType: 'json',
          async: false
        });
        return eval(rez.responseText);
        },
        { ajaxResults:true
        });
      });
      $('input[id^=foods]', $newTr).val('');
      $newTr.insertAfter('#tb1 tbody>tr:last');
    });
  });

Reply via email to