簡體   English   中英

如何在TypeScript中使用文檔Object Model?

[英]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而且我顯然不能繼續使用控制台日志。 我對 JavaScript 的經驗非常有限,但對於 JavaScript 我可以做類似的事情

“GetElementbyId”,並在 JS 中對其進行操作,但在 TypeScript 中似乎沒有等值(雖然我可能錯了......)

我嘗試查找 TypeScript 操作 DOM 的教程,但我找不到任何教程。 有沒有辦法用 TypeScript 操作 HTML 元素,如果是這樣,我將如何做 go?

使用 TS 操作 DOM 與 JS 極為相似。 這是文檔頁面的鏈接: https://www.staging-typescript.org/docs/handbook/dom-manipulation.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM