$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.