0

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?

win4win
  • 323
  • 6
  • 20
  • Does this answer your question? [How do I change the ID of a HTML element with JavaScript?](https://stackoverflow.com/questions/1650299/how-do-i-change-the-id-of-a-html-element-with-javascript) – Heretic Monkey Feb 19 '20 at 22:29
  • 2
    TypeScript is a superset of JavaScript. When searching for "how to do something" don't limit yourself to "...in typescript". – Heretic Monkey Feb 19 '20 at 22:29

1 Answers1

0

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;
}
Natixco
  • 651
  • 5
  • 20