Disable checkbox when selecting next [duplicate]

0

I have a problem related to the hidden div that appears when selecting the check, as I can not use the radio button for a reason of a function that is being used, I need to execute in the checkbox, however when switching from checkbox to the previous div is still enabled, the code is here at link

How can I fix this?

    
asked by anonymous 06.07.2018 / 19:20

1 answer

0

Every time you give show on a div , give hide all the others.

$("#add-festa-p").change(function() {
  if ($(this).prop('checked')) {
    $("#add-festa-p-div").show();
    $("#add-festa-k-div").hide();
    $("#add-festa-s-div").hide();
    console.log("Mostra a DIV");
  }
});

$("#add-festa-k").change(function() {
  if ($(this).prop('checked')) {
    $("#add-festa-k-div").show();
    $("#add-festa-p-div").hide();
    $("#add-festa-s-div").hide();
    console.log("Mostra a DIV");
  }
});

$("#add-festa-s").change(function() {
  if ($(this).prop('checked')) {
    $("#add-festa-s-div").show();
    $("#add-festa-k-div").hide();
    $("#add-festa-p-div").hide();
    console.log("Mostra a DIV");
  }
});
    
06.07.2018 / 21:07