Question

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('');
        });
    });
Was it helpful?

Solution

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/

OTHER TIPS

   $('.LikeThis').live('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("modules/like/likeit.php?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('');
            });
        });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top