im trying to gather an amount from a input box and then tick a certain amount of boxes which is an array.
this is what i got so far and it doesnt work :S
function checkAmount(ting) {
var boxes = document.getElementsByTagName("input");
for (var i = 0; i < ting.value; i++) {
if (boxes[i].name == "vote[]") {
boxes[i].checked = true;
}
}
}
And im calling it with this:
uncheckAll();
checkAmount(document.getElementsByName(\'ammount\'));
ting.valuebutting.length