点击li而不是想要调用getchat功能。但是当点击“接受并拒绝”时,也会调用LI click.want来停止这两次。
<li onclick="getchat(this,23,'ankit patel',32565,1119)" class="<divclass="status"></div>
<div class="user_image">
<img width="24" height="24" class="userimagechat" src="../Contentimage/32565/profile.jpg?e13a6f42?random=1462861613328?random=1462861614562?random=1462861615403?random=1462861616392" alt="">
</div>
<div class="user_info">
<span class="pull-right dt">22 minutes ago</span>
<span class="name">ankit patel<span>- ankit Diamond</span></span>
<div class="clearfix"></div>
</div>
<div class="user-chat-btn">
<ul>
<li class="accept-btn"><a class="clsaccept" onclick="acceptleadreq(this,23,32565)">Accept</a></li>
<li class="reject-btn"><a class="clsreject" onclick="rejectleadreq(this,23,32565)">Reject</a></li>
</ul>
</div>
</li>
答案 0 :(得分:0)
通过检查班级名称来管理单个功能中的单击。 HTML:
<span class="pull-right dt">22 minutes ago</span>
<span class="name">ankit patel<span>- ankit Diamond</span></span>
<div class="clearfix"></div>
</div>
<div class="user-chat-btn">
<ul>
<li class="accept-btn"><a class="clsaccept" >Accept</a></li>
<li class="reject-btn"><a class="clsreject" >Reject</a></li>
</ul>
</div>
</li>
使用Javascript:
function getchat(obj,a,b,c,d) {
if($(obj).hasClass('clsaccept') || $(obj).hasClass('accept-btn')) {
acceptleadreq(obj, a, c);
return;
} else if($(obj).hasClass('clsreject') || $(obj).hasClass('reject-btn')) {
rejectleadreq(obj, a, c);
return;
} else
// Do as required
}