我试图获得的价值标签<?php$i = 0;foreach ($categories as $key => $category) { ?> <div class="col-6 col-md-4 col-lg-2 text-center category"> <li class="main-li" id="<?php if ($i == 0) { $i = 1; echo 'active-nav'; } ?>" value="<?php echo $key ?>"> <?php echo $category ?> </li> </div><?php } ?>这是我的查询$(".category").click(() => { var category_id = $('li #active-nav').attr('value'); alert(category_id);});当我单击每个类别 div 时,任何人都可以帮助获得价值
添加回答
举报
0/150
提交
取消