There are tables that have dimensions from 2 to 10, there are buttons that add / remove rows / columns in tables
1) With the addition and removal of problems did not arise, but could not make restrictions, i.e. initially delete buttons are inactive, after adding rows and columns are activated, the same with adding, when rows or columns 10, buttons "add" become inactive when decreasing again active
$('.add_row').click(function(){ if ($("#amatrix").prop("checked")){ $('#Atable tr:last').clone().appendTo('#Atable tbody'); }else if($("#bmatrix").prop("checked")) { $('#Btable tr:last').clone().appendTo('#Btable tbody'); } }); if ($('#Atable tr').length > 2) { $('.del_row').removeAttr("disabled").click(function(){ if ($("#amatrix").prop("checked")){ $('#Atable tr:last').remove(); }else if($("#bmatrix").prop("checked")) { $('#Btable tr:last').remove(); } }); } else { $('.del_row').prop('disabled', true); }
2) The second problem is that when editing table fields, a block with buttons changes color, but this only works for already existing fields, nothing happens when editing added fields. How can I track and add items? And also with placeholder, tell me how to fill in the correct values of the new fields?
$('.elem_matrix').bind("change input", function() { $('.left_side').css('background', '#5199db'); }).focusout(function(){ $('.left_side').css('background', '#bcbcbc'); });