I am trying to create a checkbox dynamically using following html/javascript. Any ideas why it doesnt work?
<html>
<head>
</head>
<body>
<div id="cb"></div>
<script type="text/javascript">
var cbh = document.getElementById('cb');
var val = '1';
var cap = 'Jan';
var cb = document.createElement('input');
cb.type = 'checkbox';
cbh.appendChild(cb);
cb.name = val;
cb.value = cap;
cb.appendChild(document.createTextNode(cap));
</script>
</body>
</html>