Back to Top
The nuts and bolts for
Creative web development

Real-world JavaScript: Scripting Checkboxes

What is a checkbox really used for, and how can you change it with a JavaScript? Is it even possible? It certainly is, and in this article you'll find out how to manipulate checkboxes in a form using the mysterious "type" property. Create a toggle switch and turn on and off mass checkboxes with a flick of the wrist! Amazing! Tom continues showing you how to make fully-functional forms, and shows how to make sure that they are Accessible under 508 and disability discrimination legislation - and it's all easier than you think!

This self-contained article will contain the first of many JavaScripts that will be part of a library of scripts you can keep free of charge for your own use.

Overview

Table of Contents:

  • Taking a Closer Look at the Checkbox
    • The Checkbox Event Handler
    • A Quick Note About Using Checkboxes
    • Our Script
    • The Example HTML
    • Accessible Forms
    • Scripting the Toggle Function
    • The Type Property
    • Please, No One Trick Ponies
    • Unchecking the Toggle
    • One More Wrench

Share this Article