控制元素的点击执行事件只执行一次

if(e.handled !== true){ }
e.handled=true;
function(e)
 
 
 
完整例子:
$('.shoucangtitlele').click(function(e){
                if(e.handled !== true){
                    var data = $(this).attr('data');
                    alert(data);
                    if(data=='on'){
                        $(this).children('b').html('已收藏');
                        $(this).children('span').addClass('shoucanghou');
                        $(this).children('span').html('<i class="fa fa-star" aria-hidden="true"></i>');
                        $(this).attr('data','off');
                    }
                    if(data=='off'){                
                        $(this).children('b').html('收藏');
                        $(this).children('span').removeClass('shoucanghou');
                        $(this).children('span').html('<i class="fa fa-star-o" aria-hidden="true"></i>');
                        $(this).attr('data','on');
                    }
                e.handled=true;
                }
            });
原文地址:https://www.cnblogs.com/mm2015/p/5968806.html