我想要一个 id 值iin_no
在 while 循环中单击client_name类,假设有 50 行。
<td>
<a href="#">
<strong class="text-custom client_name">
<u><?php echo $fetch_data['Name_as_per_pan']; ?></u>
</strong>
</p>
</a>
</td>
<div id="iin_no">
<p><?php echo $fetch_data['iin']; ?>
</div>
试试这个:
$(".client_name").click( ()=> {
$("#iin_no").html($(this).find("u").html());
});
像这样做
$(".client_name ul").on('click',function () {
$("#iin_no").html($(this).html());
});
改 性:-
$(".client_name ul").on('click',function () {
var id = $("#iin_no p").eq(0).html();
alert(id);
});
我想它会帮助你。
这是完美的工作。请仅将iin_no
的ID更改为类。
$('strong.client_name').on('click',function(){
var iin_no = $(this).parents('tr').find('div.iin_no').text();
});