Forum Moderators: open

Message Too Old, No Replies

Get tag contents

using DOM/JS

         

stef25

1:13 pm on Apr 20, 2006 (gmt 0)

10+ Year Member



I’d like to use javascript/DOM to assign “foobar” to a variable, in: <p id=”par”>foobar</p>

Using document.par.value does not work … not sure if this is at all possible. Should I use innerHTML?

whoisgregg

1:30 pm on Apr 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Using innerHTML:

document.getElementById('par').innerHTML = 'foobar';