0

That's my code when I run it the openFiles function (that needs to be fired only after checkbox is clicked) fires anyway and that obj is the window not the checkbox... why ? how to fix that? what am I missing?

function openFiles(that) {
    alert("have not touched js for a long time :(");
} 

 function checkbox (){          
     var checkbox = document.createElement('input');
     checkbox.type = "checkbox";
     checkbox.name = "chkbox";
     checkbox.id = "chkid" ;
     checkbox.style = "width:50px";
     checkbox.onclick = openFiles(this);                     
}
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Damkulul
  • 1,406
  • 2
  • 25
  • 59

0 Answers0