lundi 6 janvier 2020

How to make a checkbox show/hide text with onChange event

I am working on a checkbox that shows a new textbox when clicked. It's just two textboxes where one of them is hidden. When the checkbox is checked it shows the hidden textbox and hides the already enabled textbox.

I am using the onChange event to show/hide, but I can only manage to turn it on once. And since I'm just starting out using Javascript, I haven't really worked out all the variables on how make two onChange events for the same checkbox (*. I am using onChange as it reacts to the checkbox itself, while onClick somehow only react to everything except the checkbox.

Another problem is that I'm using Wix Corvid to program it, and I don't get any functioning name or ID on the checkbox.

$w.onReady(function (){ 
$w('#checkboxGroup1').onChange((event)=> {
$w('#text108').show();
$w('#text106').hide();  
})
});



Aucun commentaire:

Enregistrer un commentaire