#div2{
text-transform:uppercase
}
#invisible{
display:none
}
<div id='container'>
<div id='div1'>
<span>some text</span>
<div>
<span>some text</span>
<div id='div2'>text2</div>
</div>
</div>
<div id='invisible'>invisible text</div>
<div id='div3'>text3</div>
</div>
Suppose I want to get the innerText of a part of the document from div2 to div3 inclusively, so I should get the following text value:
TEXT2
text3
How can I get that value?
I can select some part of HTML document via the Range object, but Range object does not have innerText property. (I'm talking about innerText, not textContent, because I want the extracted text to look identically to the rendered version in the browser, i.e. respecting the CSS properties like display
, visibility
, white-space
, text-transform
etc.)