3

I'm trying to run click event handler using jquery 1.7 by clicking on anchor tag. This code is working fine in firefox, but I'm not able display alert box using same code in IE 10. Could anyone please tell me how to achieve this functionality in internet explorer 10?

$(document).ready(function() {
    $('.call-link').on('click', function (ev, evData) {
        alert("hello world");
    }); 
});
dersvenhesse
  • 6,276
  • 2
  • 32
  • 53
Dusk
  • 2,191
  • 6
  • 38
  • 57

3 Answers3

6

It is not calling in IE because the element is disabled.

see: Demo

$(document).ready(function() {
    $('.call-link').click(function (ev, evData) {
        alert("hello world");
    });
});
Linga
  • 10,379
  • 10
  • 52
  • 104
Deep Sharma
  • 3,374
  • 3
  • 29
  • 49
  • 2
    @Dusk because disabled attribute on none input element is not standart. So using invalid code can give unexpected result. And its quite strange you set disabled attribute and still expect it to fire attached handler. The opposite as in IE seems more logic, isn't it?! – A. Wolff Feb 06 '14 at 11:40
  • check http://stackoverflow.com/questions/7833854/jquery-detect-click-on-disabled-submit-button it will answer. – Deep Sharma Feb 06 '14 at 11:41
1

Try :

$(document).on('click', '.call-link', function (ev, evData) {
        alert("hello world");
}); 

Demo : http://jsbin.com/tucu/1/

Roy M J
  • 6,926
  • 7
  • 51
  • 78
1

The expected behaviour in IE is that a button or link doesn't fire any events when it's disabled. Your link is disabled. So the event is not getting fired.