validating radio buttons with jquery but not when hidden

validating radio buttons with jquery but not when hidden

I have a page with two tables. The first is visible and the second is hidden when the page loads.

If the last two items (in color) in the first table have either "Yes" choice selected, then the second table appears.

I need to add validation to make sure all visible items are selected before the form submits. The problem I'm having is that if the second table is hidden (because "No" is selected for last two items in first table), the form should submit the data from the first table because the second table is not showing.

However, if both tables are showing, then all responses are required before the form submits.

Here's my attempt. The page is also listed below.

I would appreciate help on this. I've really been struggling.

Thanks,
Mike