PDA

View Full Version : nodeValue pseudo selector



ucl
17 Apr 2015, 4:51 AM
Hello,

I have this html code loaded into a container.



<table>
<tr>
<td>Sex</td>
<td>Mal</td>
</tr>
<tr>
<td>Date of death</td>
<td>00-00-0000</td>
</tr>

</table>


I want to select the nodes of the table: 00-00-0000 and Male.

I wrote this code:


var q=Ext.dom.Query,
sex=q.selectNode('td:prev(td:nodeValue(Sex))'),
date=q.selectNode('td:prev(td:nodeValue(Date of death))');

console.log(sex.innerHTML+'-'+date.innerHTML);


I get the value for the sex node but I receive a parsing error for the date node:


Ext.DomQuery.compile(): Error parsing selector. Parsing failed at ")""


It is clear that the problem is with spaces in the "Date of death".

Could anyone please help?

Thank you in advance,

Ucl

Gary Schlosberg
17 Apr 2015, 3:36 PM
Can you use textContent instead of nodeValue?

ucl
19 Apr 2015, 2:01 AM
Can you use textContent instead of nodeValue?

Thank you for your quick reaction.

In fact, I don't see how to use textContent instead of nodeValue.

I tried:
td[textContent="date of death"]
td[text()="date of death"] //as in xpath


But it didn't work.

Kind regards,
UCL