Query selector /3a

Asked

Viewed 73 times

0

I’m making js of htmls complexes that were not structured by me. To facilitate use of Firebux or Chrome Developer to copy the ready selector. They return me this selector:

#dadosCadastrais\3a dadosCadastraisPessoaTable\3a 0\3a j1_data > tr > td:nth-child(1)

But the browser doesn’t understand this \3a

I want to capture the tag: <td role="gridcell">Paulo Henrique</td>

The html structure is this:

<form target="_self" enctype="application/x-www-form-urlencoded" action="http://pcnisapr02.prevnet/cnis/faces/pages/requerimento/painelcidadao/painelCidadao.xhtml" method="post" name="dadosCadastrais" id="dadosCadastrais">

    <span id="dadosCadastrais:dadosCadastraisContainer"><div class="ui-datatable ui-widget center-block dtp-painel-datatable" id="dadosCadastrais:dadosCadastraisPessoaTable">
            <div class="ui-datatable-header ui-widget-header ui-corner-top">
                <div class="btn-toolbar">
                    <div class="btn-group">
                        <span class="ico-user"></span> Dados Cadastrais
                    </div>

                </div>
            </div>
            <div class="ui-datatable-tablewrapper"><table role="grid">
                    <tbody class="ui-datatable-data ui-widget-content" id="dadosCadastrais:dadosCadastraisPessoaTable_data">
                        <tr role="row" class="ui-widget-content ui-datatable-even" data-ri="0">
                            <td role="gridcell">
                                <div class="ui-datatable ui-widget" id="dadosCadastrais:dadosCadastraisPessoaTable:0:j1">
                                    <div class="ui-datatable-tablewrapper">
                                        <table role="grid">
                                            <tbody class="ui-datatable-data ui-widget-content" id="dadosCadastrais:dadosCadastraisPessoaTable:0:j1_data">
                                                <tr role="row" class="ui-widget-content ui-datatable-even" data-ri="0">
                                                    <td role="gridcell">Paulo Henrique</td>
                                                    <td role="gridcell">Casa</td>
                                                    <td role="gridcell"></td>
                                                    <td role="gridcell">09/09/1993</td>
                                                    <td role="gridcell">27/12/2011</td>
                                                    <td role="gridcell">Nit normal</td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </td></tr></tbody></table></div></div></span>
</form>
  • can update the response with the HTML structure you want to capture?

  • Updated. As said the code came ready, unfortunately I can not change the structure of html.

  • By code, the 3a refers to the : of the id dataCadastrais:dataCadastraisPessoaTable:0:j1_data

  • If this HTML is fixed, the first TD of this table can be captured with the code Document.getElementById('dataCartists:dataCartists Useable:0:j1_data'). querySelector('td')

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.