[英]Get id of .class from php do-while loop
do{
<div class="fine" id="<?php echo $i; ?>"><?php echo $tb_dt_01 ?></div>
}while..........
$($('.fine').attr('id')).mouseover(function() {
alert($('.fine').attr('id'));
});
I have the above do-while php loop, the results are displayed with $i incremental. 我有上面的do-while php循环,结果以$ i增量显示。 I want to get the id from .fine.
我想从.fine获取id。 But currently it gives me the first value or no value.
但目前它给了我第一个价值或没有价值。 The alert is just given as a test, to check if the values are given correctly
警报仅作为测试给出,以检查是否正确给出了值
try 尝试
$(".fine").mouseover(function() {
alert($(this).attr("id"));
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.