how to dynamically create a set of checkboxes

how to dynamically create a set of checkboxes

This is quite a newbie question about a jquery tutorial I found at http://remysharp.com/2007/09/18/auto-populate-multiple-select-boxes/.

I wish to change the example so that the second box ('elements') contains a set of checkboxes instead of a select list:
http://remysharp.com/wp-content/uploads/2007/09/select-chain.php

The .js is here:
http://remysharp.com/wp-content/uploads ... t-chain.js

I think I need to amend the document.createElement("OPTION") to something like document.createElement("checkbox") but I am not sure and I do not know what else to amend in the code.

Or if someone can show a simple way to create checkboxes dynamically it would be a start.