Checkboxes in Prototype

October 9th, 2008 § 4

observing:
$(’mycheckbox’).observe(’click’, function(e){alert(’checked = ‘ + this.checked);});

setting throught scripting:
$(’mycheckbox’).checked = true;
$(’mycheckbox’).setAttribute(’checked’, true);
$(’mycheckbox’).setValue(”); // will un-check/null value
$(’mycheckbox’).setValue(’anything’); // will check/on value
$(’mycheckbox’).click(); // will toggle the checkbox

Related posts:

  1. Prototype: submit multiple select with ajax call

Tagged: ,

§ 4 Responses to “Checkboxes in Prototype”

  • Matt Hakes says:

    Outstanding. It helped me build a lot more flexibility into my prototype boxes. Thanks

  • lav says:

    Thanks for the great tips.

  • symer says:

    Nice blog btw

  • nathan says:

    I came across. Thank you.

  • § Leave a Reply

What's this?

You are currently reading Checkboxes in Prototype at westworld: a webmasters best friend.

meta