سؤال

I have implemented Dhtmlx Scheduler for taking an appointment from website. Everything works fine but few methods are not working in IE8.

Following is my onEmptyClick Method:

scheduler.attachEvent("onEmptyClick", function (date, native_event_object){

if(!$(native_event_object.target).hasClass('dhx_scale_holder')){
   var s=confirm("Are you sure, You want to take an appointment");
   if(s){ // proceed appintment}
}

});

Here problem is with hasClass. On other browser it works all right. But on IE8 it returns "native_event_object.target" as Undefined, which is causing all the problems.

It returns "native_event_object" all good I can even see target in console.

Any Idea how to fix this ?

هل كانت مفيدة؟

المحلول

I figured it out.

IE does not support ".target". So I add checked before my code.

scheduler.attachEvent("onEmptyClick", function (date, native_event_object){

     if(typeof native_event_object.target === 'undefined')
        var currTarget=native_event_object.srcElement;
     else
        var currTarget=native_event_object.target;

     if(!$(currTarget).hasClass('dhx_scale_holder')){

        var s=confirm("Are you sure, You want to take an appointment");
        if(s){ // proceed appintment}

     }


});
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top