Questions tagged [nodevalue]

In DOM, the nodeValue property sets or gets the node value of the specified node

In DOM (Document Object Model), the nodeValue property sets or gets the node value of the specified node. When using nodeValue as getter, the result can often be the text within the selected node. When using nodeValue as setter, it can be used to change the text within the specified node.

76 questions
152
votes
6 answers

nodeValue vs innerHTML and textContent. How to choose?

I'm using plain js to alter the inner text of a label element, and I wasn't sure on what grounds I should use innerHTML or nodeValue or textContent. I don't need to create a new node or change the HTML elements or anything — just replace the text.…
adam Kiryk
  • 1,735
  • 2
  • 14
  • 14
24
votes
2 answers

How do I choose between innerText or nodeValue?

When I need to change a text within a span element, which one should I use and what is the difference: var spnDetailDisplay=document.getElementById('spnDetailDisplay'); spnDetailDisplay.innerText=sDetail; or var…
pencilCake
  • 51,323
  • 85
  • 226
  • 363
17
votes
2 answers

How to get the html inside a $node rather than just the $nodeValue

Description of the current situation: I have a folder full of pages (pages-folder), each page inside that folder has (among other things) a div with id="short-info". I have a code that pulls all the
...
from that folder…
EEC
  • 173
  • 1
  • 1
  • 4
16
votes
3 answers

php domdocument get node value where attribute value is

Say my XML looks like this: this item this url Now I'm doing something like this: $xml = new DOMDocument(); $xml->load('xmlfile.xml'); echo…
Frits
  • 161
  • 1
  • 1
  • 4
10
votes
3 answers

Javascript nodeValue returns null

Title should make my problem well described.Here goes my code.
Some text