I've write a addrow event like this....
$('.addRow').click(function(){
var $newTr = $('#tb1 tbody>tr:last').clone(true);
$newTr.insertAfter('#tb1 tbody>tr:last');
newRowNum += 1;
$newTr.find('input[id^=foods]').attr('id', function(){
var newID = 'foods' + newRowNum ;
$(this).attr('id',newID).attr('name',newID).attr('class',newID);
});
$('input[id=foods'+ newRowNum +']').jsonSuggest(
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
});
New rows just cloned including a formfield, I've assign new formfield ID, and want to use suggestbox function in this new create formfield, However it seems proceed many times base on the variable newRowNum, after click the addrow button 3times, I use firebug and saw like this... Would you mind to tell me how to stop the accumulative proceed in this function? Thank you very much.
Cage
<td height="30">
<input id="foods3" class="foods3" type="text" maxlength="30" size="35" name="foods3" autocomplete="off"/>
<div class="jsonSuggestResults" style="top: 203px; left: 283.55px; width: 232px; display: none;"/>
<div class="jsonSuggestResults" style="top: 203px; left: 283.55px; width: 232px; display: none;"/>
<div class="jsonSuggestResults" style="top: 203px; left: 283.55px; width: 232px; display: none;"/>