function con() { if ($('input[class=con]:checked').length == 2) { $('.all').show(); hrt(); } else { $('.all').hide(); } } function hrt() { const val = $('input[name=hrt]:checked').attr('id'); var chk = ''; if (val == 't1') chk = 'masc'; else if (val == 't2') chk = 'fem'; if (chk == 'masc' || chk == 'fem') { $('.some').show(); $('.' + chk).show(); const not = chk == 'masc' ? 'fem' : 'masc'; $('.' + not).hide(); } else { $('.some').hide(); } } function sex() { if ($('input[name=sex]:checked').length == 1) { $('.hide').show(); hrt(); } else { $('.hide').hide(); } } $(document).ready(function() { con(); hrt(); sex(); }); $(document).on('change', 'input[class=con]', con); $(document).on('change', 'input[name=hrt]', hrt); $(document).on('change', 'input[name=sex]', sex); var num = 1; function row() { let text = $('.medication div:first').html() let newtext = text.replace(/\[0\]/g, '[' + num + ']'); $('.medication').append('
' + newtext + '
'); } var opened = false; $(document).on('click', function(event) { if (event.target.id == 'hamburger' && !opened) { $('nav').css('display', 'block'); opened = true; } else { $('nav').css('display', 'none'); opened = false; } });