Link to home
Start Free TrialLog in
Avatar of debbieau1
debbieau1Flag for United States of America

asked on

checkbox onclick show

I have a checkbox

<input name="mycheck" type="checkbox" value="1" id="mycheck" />

I want to call a hideinfo function  (if it is not selected)   or showinfo function (if checkbox value is selected).  I need to call a function, not show a div as I am using this with canvas.

So it should be if checkbox is selected (has 1) then run showinfo()
 if checkbox is not selected  then run hideinfo()
Avatar of leakim971
leakim971
Flag of Guadeloupe image

<input name="mycheck" type="checkbox" value="1" id="mycheck" onclick="if(this.checked) showinfo();else hideinfo();" />

Open in new window


if(document.getElementById('mycheck').checked=true) showinfo();
else hideinfo();

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of debbieau1

ASKER

Thanks
Thanks heaps erdincgc

Very helpful.  

I can use both solutions in what I am doing.  Thanks again