asked on March 20, 2017
•
Show version history
$(document).ready(function(){ function clearout() { //$('.Tier').each(function(){$(this).find('option:first').attr('selected', 'selected')}); //$('.Tier').find('option:first').attr('selected', 'selected'); $('.Type').find('option:first').attr('selected', 'selected'); $('.Code').each(function(){$(this).val("")}); $('.UnitPrice').each(function(){$(this).val("")}); $('.Quantity').each(function(){$(this).val("")}); $('.LineTotal').each(function(){$(this).val("")}); } function autofill() { $('.autofill').trigger('click'); } $('.Category').change(clearout); $('.Quantity').change(autofill); $('.cf-table-add-row').click(function(){ $('.Category').change(clearout); $('.Quantity').change(autofill); }); });
Hi, I want to make it so that if the user changes a certain field (Category), then all of the other fields in that row are blanked out.
Right now it works for all of the text fields, but I can't get it to work for only the one row, or for the drop downs. The second commented line clears the Tier properly but for all rows. The top line just doesn't work. The "each" lines clear but for every row, when I only want the current row.
0
0