How to add a value between a dom element?

Issue

This is my element:

<var mathquill-command-id="56"></var>

I want to add something between like this:

<var mathquill-command-id="56">HERE</var>

This is my process so far:

const p = document.createElement('var')
p.setAttribute('mathquill-command-id', '56')
this.p.value = 'HERE'
this.main.append(p)

this.main is the parent element.

But it looks like .value does not work. I got the idea to use .value from how textbox element works.

Solution

Do something like this:

p.innerHTML = 'HERE'

Answered By – Arthur Medeiros

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published