We have a form with a table and 3 fields in it. One of the fields is a radio button. We are trying to get it setup where if they select a value from the radio button the form will require the text field to be filled in next to it.
We have tried a few things and haven't had much results. This code is the closest thing I've come up with but it is still not working. Does any one have any ideas?
$(document).ready(function () {
updatefield();
$('.inspectiontable').change(updatefield);
function updatefield() {
$('.inspectiontable tbody tr').each(function () {
var insType = $(this).find('.raiting input:checked').val();
switch (insType) {
case "Unsatisfactory":
$(this).find('.explain input').attr('required', true);
return;
default:
$(this).find('.explain input').removeAttr('required');
return;
}
});
}
});