Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
Data attr in second td is undefined

Content comes from DB. I go foreach on array and insert rows into table. This is the structure of 1 row:

<tr>
    <td data-name = '<?php echo $name ?>'><?php echo $name ?></td>
    <td data-email = '<?php echo $email ?>'><?php echo $email ?></td>
    <td><form method='post'><button class='delete' name='delete' ...>Remove</button></form></td>
<tr>

I am trying to get the content of each data attribute in a row:

 $('.delete').click(function (e) {
        e.preventDefault();
        let name = $(this).parents('tr:first').find('td').data('name');
        let email = $(this).parents('tr:first').find('td').data('email'); // <--- undefined  
        if (confirm(name + ' ' + email + ' delete?')) {
          ...code goes futher...

The question is: I get name value, but email is undefined. What is wrong? I also see the value of email variable in the table and in data attr in dev Console

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!