1

I have a project that is already using jQuery, so I'd like to stay in theme.

How can I reference the following selector and obtain the contents? I've highlighted the fields text I'm after, below.

Chrome reports the selector as:

#gv-field-10-43 > td

I have tried variations on the following, but both result in the variable returning empty or undefined:

jobNo = jQuery("#gv-field-10-id > td").text();
jobNo = jQuery("#gv-field-10-id > td").html();
<table class="example">
    <thead>
    </thead>
    <tbody>
        <tr id="gv-field-10-id" class="gv-field-10-id">
            <th scope="row">
                <span class="gv-field-label">Entry ID</span>
            </th>
            <td>
                5602 <-- This is the text I'm trying to find
            </td>
        </tr>
    </tbody>
</table>
anakaine
  • 610
  • 6
  • 17
  • what is the problem? – brk Jun 28 '20 at 10:39
  • The problem is actually that this was closed with an improper reason. I have resolved the issue over the course of the past 12 hours and would be willing to offer a solution, and explanation, but cannot do so. The issue, to be clear, has nothing to do with the DOM not being loaded, and nothing to do with any document ready / load issues. The issue is actually with the way the object is being identified. @Quentin – anakaine Jun 28 '20 at 22:41
  • @anakaine — You're wrong. The way it is being identified is absolutely fine: https://jsbin.com/huvanuzaga/1/edit?html,js,output (Possibly you have a different problem with some other code which is different to the code you asked about, but for the question you asked, the duplicate covers the only possible solutions). – Quentin Jun 29 '20 at 08:20
  • Well, this is what has wound up working reliably. https://pastebin.com/ZRmXzrG6 – anakaine Jun 30 '20 at 01:31

0 Answers0