Small tip to get the status of checkbox

Hi all,

It  took me long time to get it… I wanted to check if a checkbox was checked or not.
So I used:
var checkbox = document.getElementById("checkbox_id").value;

Wrong! Wrong! Wrong!

the right way is:

var checkbox = document.getElementById("checkbox_id").checked;

which return true or false. Minor details wasted me lots of time…

Admin

Leave a Reply