Catch all parent elements

3

I'm having a situation, where I have a table that does not have class . It looks like this:

<table>
   <tr> //Pegar aqui
       <td>
           //Aqui continua a tabela
       </td>
   </tr>
   <tr> //Pegar aqui
       <td>
           //Aqui continua a tabela
       </td>
   </tr>
</table>

Return I want to do:

<tr>
    //oque tem dentro
</tr>

<tr>
    //oque tem dentro
</tr>

In this way, we have tables inside tables. I would like to get the entire list of the first <tr> . But when I select $("table tr") , it enters the other elements and selects everything.

How do I select only the first career of <tr> , and not enter into them?

    
asked by anonymous 29.10.2016 / 14:07

1 answer

3

To solve the problem I performed the following procedure:

$(b).find("tbody tr:first").siblings().andSelf().each(function(a,b){
    console.log(b)
});
    
29.10.2016 / 16:02