jQuery click event on IE7-8, does not execute on the div, only on its text

Posted by user3665301 on Stack Overflow See other posts from Stack Overflow or by user3665301
Published on 2014-06-09T15:20:50Z Indexed on 2014/06/09 15:24 UTC
Read the original article Hit count: 402

I have a problem using the jQuery click event with IE7-8-9. I apply the event on a div. But on these two IE versions, I have to click on the text contained within the div to make the event work.

I don't understand because it was still normally working on these versions until I made a few changes (like adding the font css properties) but when I try to delete these changes it stil does not work as I want;

Here is a jsfiddle illustrating the situation and its full screen result.

http://jsfiddle.net/rC632/

function clickEvent(){

$('.answerDiv').click(function(){
    $( "div:animated" ).stop();
    if ( idPreviousClick === $(this)[0].id) {

    } else {
        if (idPreviousClick != -1) {
            $("#"+idPreviousClick).css({height:'100px', width:'100px', top:'0', 'line-height': '100px'});
            $("#"+idPreviousClick).parent().css({height:'100px', width:'100px', top:'0'});
        }
        $(this).animate({height:'120px', width:'120px', 'line-height': '120px'});
        $(this).parent().animate({height:'120px', width:'120px', top:'-10px'});
        idPreviousClick = $(this)[0].id;
    }
});

}

$(document).ready(function(){

clickEvent();

});

var idPreviousClick = -1;

http://jsfiddle.net/rC632/embedded/result/

Could you have any idea of what is missing ?

Thanks

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about internet-explorer