I have a form in which 3 questions show the same part of the form, and their answers are yes or no, but when one of them is not and the other yes, it hides the questions of the form that are also valid for the other questions .
jQuery
<script>
$(document).ready(function(){
var $profissional = $("#decorrencia-profissional"),
$futura = $("#decorrencia-futura"),
$sinistroIndenizado = $("#sinistro-indenizado"),
$possuiSinistro = $(".possui-sinistro");
$($profissional, $futura, $sinistro).change(function() {
if($(this).val() === "Sim") {
$($possuiSinistro).show(1000);
} else if $(this).val() === "Sim" && $(this).val() === "Não"{
$($possuiSinistro).show(1000);
} else{
$($possuiSinistro).hide(1000);
}
});
$($possuiSinistro).hide(1000);
});
</script>