I'm trying to attach an onchange event to a checkbox created by js.
I finally gotten the closure to work inside a for loop, but now it activates on load rather than on change.
Why is this?
https://jsfiddle.net/dkrh587h/2/
chkbox.addEventListener("change", (function(newVarA, newVarB, newVarC, newVarD) {
searchMap(newVarA, newVarB, newVarC, newVarD);
}(gblStatus, "Status", statuser, chkbox.checked)), false);