I’m creating a web page for my internship and I want to add a div “example” when the checkbox named “example” is checked. I want to delete this div when it’s unchecked.
I really don’t know how to start, and what to do.
Edit :
Ok I see.
I have several checkboxes, is there a way to do it for everyone ?
Here I create my checkboxes :
my %labels = (
'rdc7' => 'switch-rdc-7',
'rdc8' => 'switch-rdc-8',
'rdc4' => 'switch-rdc-4',
'3750' => 'switch-3750'
);
print $cgi->checkbox_group(
-name => 'switch_choices',
-values => ['rdc4', 'rdc7', 'rdc8', '3750'],
-default => ['rdc7', 'rdc8'],
-labels => \%labels
);
And when it’s checked, I want to add a div by :
my $switch1 = SwitchGUI->new("switch-rdc-7", 24, 2);
(it produce a div with id=”switch-rdc-7″).
1 Answer