duandi8838 2012-05-07 13:25
浏览 52
已采纳

livequery不工作ie

hello friends i am working on a like module .and having some difficulties running it on ie . in all other browsers its running fine . the prob is when i click on like button nothing happens in ie . can anyone see my piece of code and help me out . IE is Such a pain .

           $('.LikeThis').livequery("click",function(e){

        var getID   =  $(this).attr('id').replace('post_id','');
        var uid = $('.like_uid').val();
        var type_id = $('.like_type_id').val();


        $("#shlike-loader-"+getID).html('<img src="images/icons/like.gif" alt="" />');

    $.post("eg?postId="+getID+ '&uid=' + uid + '&type_id=' + type_id, {


        }, function(response){
            $('#hiddenlikesval'+getID).remove();
            $('#likepanel'+getID).show();
            $('#likecontainer'+getID).append($(response).fadeIn('slow'));
            var bing=$('#hiddenlikesval'+getID).val();
            $('#lplbl'+getID).html(bing);
            $('#likePanel'+getID).css({'display':'block','width':'404px','padding':'5px 3px 5px 3px','background':'#ECEFF5'});
            $('#like-panel-'+getID).html('<input type="hidden" class="like_uid" id="like_uid'+getID+'" name="like_uid" value="'+uid+'"/><input type="hidden" class="like_type_id" id="like_type_id'+getID+'" name="like_type_id" value="'+type_id+'"/><div class="comtcontbtm unlwid"><a href="javascript: void(0)" id="post_id'+getID+'" class="Unlike liknlksh" title="Unlike"><span class="shareiconsbottom unlikeiconbtm"></span><span class="replyshare">unlike</span></a></div>');

            $("#shlike-loader-"+getID).html('');
        });
    });
  • 写回答

2条回答 默认 最新

  • doucan8276 2012-05-07 13:37
    关注

    Are you using jQuery 1.7? If so, you should use on, livequery is deprecated. If you're using pre-1.7 you should use .delegate.

    For 1.7 change your function declaration to:

    $(document).on("click", ".LikeThis", function (e) {
        //your stuff here
    });
    

    For pre-1.7 change it to:

    $(document).delegate("click", ".LikeThis", function (e) {
        //your stuff here
    });
    

    On: http://api.jquery.com/on/

    Delegate: http://api.jquery.com/delegate/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制