December 2017
Beginner
372 pages
10h 32m
English
The next function in our file is a window.onload function which is called when the browser is loaded. The window.onload function is a standard JavaScript function and here is a good example of TypeScript being a superset of JavaScript. All JavaScript functions can be used directly in TypeScript. In the window.onload function, we just attach the event listener to the add button:
window.onload = function(){ let name= <HTMLInputElement>document.getElementById("todoName"); let description = <HTMLInputElement>document.getElementById( "todoDescription"); document.getElementById("add").addEventListener( 'click',()=>toAlltask(name.value, description.value)); }
TypeScript allows us to type cast one type of value to another ...
Read now
Unlock full access