views:

117

answers:

2

Hi,

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 table 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 ?

A: 

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');
               });
      }
 );
virsir
+1  A: 

If you just want text and no HTML markup to worry about, use:

dojo.dom.textContent(item)
bobince