faqts : Computers : Programming : Languages : JavaScript : Forms : Checkboxes

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

123 of 227 people (54%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

How can I check that a checkbox has been checked or unchecked and get its value?

May 26th, 2000 16:52
Jeff Wagner, Byron Bignell,


Check boxes can be verified if checked by the variable's checked 
property.

For instance if your algorithm was:
if checkBoxVariable is checked then do task...

Your code would look something like:
if (document.Form.Variable.checked) {
  // do task
  // return
  }

If you wanted to see if it is UNchecked then:
if (!document.Form.Variable.checked) {
  // do task
  // return
  }