Search code examples
javascriptlit-element

Printing a property from html tag


Say you have something like this:

<input id="state" type="radio" name=${this.group} .checked=${this.checked} />

(Code from LitElement Dot with HTML elements attribute/property as I was researching what the dot meant)

Is it possible to print out what ${this.checked} is? If so, how?

Clarification: Is it possible to print it from, for example, another file?

Like if you wanted the id, it would be something like this.input.getAttribute('id'), but for the .checked


Solution

  • Did you try using ${this.checked} where you want to display it ?

    <input id="state" type="radio" name=${this.group} .checked=${this.checked} />
    (checked: ${this.checked})