Get Text from "href" with dojo?
i 've the following html:
<table id="mytable">
<thead>
</thead>
<tbody>
<tr>
<td><a href="#" onclick="doSometThingCrazy(); return false;">test</a></td>
</tr>
</tbody>
</table>
Now i want to get all links inside this tabl开发者_JAVA技巧e with dojo. So far so good:
dojo.query("#mytable a").forEach(
function(item){
dojo.connect(item, 'onmouseover', function(){
console.log(item);
console.log('x');
});
}
);
Now i want to get the text for the href (test) and look for it in an other table. Is there anyway to access this value ?
If you just want text and no HTML markup to worry about, use:
dojo.dom.textContent(item)
You can check its innerHTML, I do not know any css selector for its innerHTML.
dojo.query("#mytable a").forEach(
function(item){
if(dojo.attr(item, "innerHTML") == "TEXT")
dojo.connect(item, 'onmouseover', function(){
console.log(item);
console.log('x');
});
}
);
精彩评论