dimanche 3 décembre 2017

Javascript onchange checkbox cancel

My first question here and really hope to learn a lot. I'm actually not the technical guy at my startup but cause of the lack of it trying to do things by myself :-)

I made an onchange event for my module order system. When i click on the checkbox, the selected module appears in the summary. This works. But when i deselect the checkbox, i want the module to dissapear from the summary. That doesn't work now. What do i have to change in the JS to do that?

The checkbox

<input type="checkbox" class="custom-control-input" 
  onchange="modulecontractsSelect(this, event)">

The summary

<p id="module-contracts-summary"> </p>
<p id="module-contracts-summary-price"> </p>

The Javascript

function modulecontractsSelect() {
          document.getElementById("module-contracts-summary").innerHTML = "Module contractbeheer"
          document.getElementById("module-contracts-summary-price").innerHTML = "€5 / mnd";
        }

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire