I've create code to add table row with formfield, and try to bind the 3rd party suggestbox function the each dynamic generate formfield
<script type="text/javascript">
$(document).ready(function() {
$('#form1').validationEngine();
var newRowNum = 1;
$(".addRow").click(function(){
var $newTr = $("#tb1 tbody>tr:last").clone(true);
$newTr.find('input[id^=foods]').unbind(jsonSuggest()); <== try to unbind the previouse jsonsuggest()
//$newTr.find('.jsonSuggestResults').remove();
$newTr.appendTo("#tb1 tbody");
$('input[id^=foods]', $newTr).val('');
$newTr.find('input[id^=foods]').each(function(){
$(this).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
});
});
$newTr.find('input[id^=supplyDate]').each('id', function(){
$(this).datepicker({dateFormat:'yy-mm-dd'});
});
});
});
however, the suggestbox accumulatived, here is the result I input something at row 7... link text Would you mind to tell me how to unbind the applied function at previous row+formfield? Thank you.