Hi,
We have a form with a Radio button "Yes or No" value, we want to trigger the Java Script to make the table columns required. This is what we have done so far, but it only makes the first row of the table read-only. (We are not too concerned about the red asterisk.)
Any advice on what we are missing to do this for all rows and not just the first row?
//This is to make fields required on table based on 'royes' as radio button with yes or no $('.royes').on('change',DetailsReq); DetailsReq(); function DetailsReq(){ var cPRE = $('.royes input:checked').val(); if(cPRE === 'Yes'){ $('.pre input').each(function(){ $(this).attr('required', 'True'); }) $('.pre select').each(function(){ $(this).attr('required', 'True'); }) } if(cPRE === 'No'){ $('.pre input').each(function(){ $(this).removeClass('required').removeAttr('required'); }) $('.pre select').each(function(){ $(this).removeClass('required').removeAttr('required'); }) } } });
Then here you can see the second row is not read-only, just the first row.