jquery click event not fired on internet explorer

后端 未结 3 1458
无人共我
无人共我 2020-12-21 08:30

I am trying to do something when user clicks on label.

I am trying to get the click event fired It is

3条回答
  •  忘掉有多难
    2020-12-21 08:55

    Are you setting up your click handler inside of a dom ready callback? If not your javascript statement is probably being executed prior to the label existing in DOM.

    Here is a fiddle: http://jsfiddle.net/muglio/mTaVR/

    $(document).ready(function() {
        $('.my-label').on('click',function(evt) {
           alert('clicked');
        });
    });
    

提交回复
热议问题