[thelist] DOM - .childNode and How to Target?

Christian Heilmann codepo8 at gmail.com
Mon Apr 2 09:27:50 CDT 2007


> > > What about trying:
> > >
> > > document.getElementById('Username').nodeValue = 'Email Address';
> >
> > That doesn't make sense at all...
> > document.getElementById('Username') is an input element and as
> > elements are not text nodes the nodeValue is null.
>
> How about:
>
> document.getElementById('Username').value = 'Email Address';
>
> or
>
> document.getElementById('Username').setAttribute('value', 'Email Address');
>
> then?

This changes the value of the field, not of the label and that is the
task at hand.

-- 
Chris Heilmann
Book: http://www.beginningjavascript.com
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/



More information about the thelist mailing list