2

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
  • 48,606
  • 78
  • 218
  • 380

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
  • 48,606
  • 78
  • 218
  • 380