Skip to content

How to use Document Object Model in TypeScript?

I’m extremely new to typescript (and JavaScript for that matter), I think I’ve mastered the fundamentals when it comes to TypeScript (variables, arrays, if/else statements etc) but I would like to add functionality to my static webpages and I can’t keep using console logs obviously. My experience with JavaScript is quite limited but for JavaScript I could do something like

“GetElementbyId”, and manipulate it in JS, but in TypeScript there does not seem to be an equalivant(I’m probably wrong though…)

I tried finding tutorials for TypeScript Manipulation with DOM, but I could not find any. Is there a way to manipulate HTML elements with TypeScript and if so, how would I go about doing it?


Manipulating the DOM with TS is extremely similar to JS. Here is a link to a documentation page: