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

100
Views
jquery not working with dynamic id on click
$dns_zone = ["domain" => "user", "domain2" => "user2"];
foreach ($dns_zone as $dom => $user){
 echo '
<tr id="tr'.$dom.'">
<td>
    <span>'.$dom.'</span>
    <input type="hidden" id="name'.$dom.'" name="domain" value="'.$dom.'" />
</td>
<td>
    <i class="save " id="sid'.$dom.'" title="Save" ></i>
</td>   
</tr>';

// for Save record
$(document).on("click", ".save", function() {
var id = $(this).attr("id");
id = id.substr(3);
var domain = $("#name"+id).val();
console.log(domain );
});

i want to print which domain i select...everything look correct but dont know what the issue...whenever i tried with static value its getting right...problem with dynamic id...but i tried to print 'id' value its working properly...please help me with this...Thank You.

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!