In HTML I can write:
<input type="checkbox" id="MyBox" onchange="MyHandler(this.checked)">
Instead of specifying the handler in HTML, I want to set it TypeScript. I tried:
document.getElementById('MyBox').onchange = function(){MyHandler(this.checked); };
but get the error "Property 'checked' does not exist on type 'GlobalEventHandlers'". How do you then access the attributes of "this"?
Aucun commentaire:
Enregistrer un commentaire