I'm trying to find an element by text and get the contents of the element after it. The table will be changing depending on the user input so I can find nodes by counting down the table. And I'm not able to add class or id's to specific table elements in the application that I'm working with.
var firstnamefind = $(this).next().find("div:contains('First Name')").text(); $(".display").text(firstnamefind); <table class="arm_profile_detail_tbl"> <tbody> <tr> <td>First Name</td> <td>Neal</td> </tr> <tr> <td>Last Name</td> <td>Parker</td> </tr> <tr> <td>Email Address</td> <td>neal@email.com</td> </tr><tr><td>Phone Number</td> <td>9095551212</td> </tr> <tr> <td>Website (URL)</td> <td> <a href="https://website.com/" target="_blank">https://website.com/</a> </td> </tr> </tbody> </table> <div class="display">This should be the first name</div>
https://stackoverflow.com/questions/65385173/find-element-by-text-and-get-the-contents-of-the-element-after-it December 21, 2020 at 05:56AM
没有评论:
发表评论