" class="active" > id_permission?>">Permission Information id_pe-6ren">
gpt4 book ai didi

Jquery .on ("click") 第二次不起作用

转载 作者:行者123 更新时间:2023-12-01 01:01:25 24 4
gpt4 key购买 nike

<ul class="nav nav-tabs tabb">
<li id="li_permission_info_<?=$this->id_permission?>" class="active" >
<a data-toggle="tab" href="#tab_permission_info_<?=$this->id_permission?>"><i class="icon-user"></i>Permission Information <?=$this->id_permission?></a>
</li>
<li id="li_permission_details">
<a data-toggle="tab" href="#tab_permission_details_<?=$this->id_permission?>" data-value="<?=$this->id_permission?>"><i class="icon-home"></i>Permission Details</a>
</li>
</ul>
<小时/>
$("body").on("click", "#li_permission_details", function(event){

console.log("test");

});

我遇到问题,因为 jquery 脚本第二次没有激活单击<li>标签

最佳答案

我已经尝试过这段代码,效果很好。试试这个:

<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<ul class="nav nav-tabs tabb">
<li id="li_permission_info_<?=$this->id_permission?>" class="active" >
<a data-toggle="tab" href="#tab_permission_info_<?=$this->id_permission?>"><i class="icon-user"></i>Permission Information <?=$this->id_permission?></a>
</li>
<li id="li_permission_details">
<a data-toggle="tab" href="#tab_permission_details_<?=$this->id_permission?>" data-value="<?=$this->id_permission?>"><i class="icon-home"></i>Permission Details</a>
</li>
</ul>

<script>
$( "body" ).on( "click", "#li_permission_details", function() {
alert('Hi');
});
</script>
</body>
</html>

关于Jquery .on ("click") 第二次不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18910597/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com