ZVON > References > DOM2 Reference

nodeValue (attribute )

Owning interface and usage:  
Node.nodeValue

Member of these other interfaces:  
Attr, CDATASection, CharacterData, Comment, Document, DocumentFragment, DocumentType, Element, Entity, EntityReference, Notation, ProcessingInstruction, Text

Readonly:   no

Type:   DOMString

Description:  
The value of this node, depending on its type.

Note:  
When it is defined to be null, setting it has no effect.

Exception:  
DOMException NO_MODIFICATION_ALLOWED_ERR
This exception raises on setting when the node is readonly.
DOMException DOMSTRING_SIZE_ERR
This exception raises on retrieval when it would return more characters than fit in a DOMString variable on the implementation platform.


Example:
Text in the first DIV.
Some text in the second DIV.
Some text and element in the third DIV.
We can try another elements. It will be much more interesting.
Text in the last DIV.
Source:
   <div id="doc">
     <div>
       Text in the first DIV.
     </div>
     <div id="DDD" class="secondClass">
       Some text in the second DIV.
     </div>
     <div class="thirdClass">
       Some text and <span id="SSS">element</span> in the third DIV.
     </div>
     <div class="fourthClass">
       We can try <i>another elements</i>.
       It will be much more <b>interesting</b>.
     </div>
     <div>
       Text in the last DIV.
     </div>
   </div>
     
JavaScript:
  var output = document.getElementById('DDD').firstChild.nodeValue;
Output:
desired your browser
Some text in the second DIV.