3

Given the following example element.

<my-element>
   Hello world
</my-element>

What javascript variable would give me "Hello world"?

I've tried a bunch of things. I tried this.innerText, and this.$.content won't show unless the <content> tags are in the <template>.

ThomasReggi
  • 55,053
  • 85
  • 237
  • 424

1 Answers1

1

This works, I'm not sure if it's cross-browser:

this.textContent

Here's how I got there

Community
  • 1
  • 1
ThomasReggi
  • 55,053
  • 85
  • 237
  • 424