You can write basic js technically, but with type of course.
changeId() {
let element: HTMLElement = document.getElementById('id');
element.id = newId;
}
or just
changeId() {
document.getElementById('id').id = newId;
}
You can write basic js technically, but with type of course.
changeId() {
let element: HTMLElement = document.getElementById('id');
element.id = newId;
}
or just
changeId() {
document.getElementById('id').id = newId;
}
HTML
<span id="IDs"> hello </span>
.TS
changeID(){
// call IDs and change value
}
In TypeScript how do I change the content of id IDs
that’s in my HTML inside my .TS?
Does this answer your question?
TypeScript is a superset of JavaScript. When searching for “how to do something” don’t limit yourself to “…in typescript”.
You don’t need the
Yes. And? I wrote it that way. If you don’t like it you can answer it in your way 😉