Link to home
Start Free TrialLog in
Avatar of ercantunc
ercantunc

asked on

stopPropagation() not working in Firefox

In IE this function works (shows the calendar and allow click outside to close the calendar)
but it does not work in FF. (The calendar do not appear) any ideas?

function showCalendarControl(textField) {
  if (!e) var e = window.event;
            e.cancelBubble = true;
            if (e.stopPropagation) e.stopPropagation();
  calendarControl.show(textField);
 
}
Avatar of HainKurt
HainKurt
Flag of Canada image

is this running fine?

function showCalendarControl(textField) {
  calendarControl.show(textField);
}
if not, then ask the developer for calendarControl ;)
do you have a link to share with us so we can test?
Avatar of ercantunc
ercantunc

ASKER

Sure it runs, but I it is not possbile to share
SOLUTION
Avatar of Samuel Liew
Samuel Liew
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok I got it but in your example you do not pass it
 ith should be something like this right?

yourElement.onclick = doSomething(somethinghere?) ;
 
No, the event is automatically passed to the function.
This works in IE but in FF gives "e  is undefined error"

function showCalendarControl(textField) {
  calendarControl.show(textField);
 }
function stopProp(e){  
            if (!e) var e = window.event;
            e.cancelBubble = true;
            if (e.stopPropagation) e.stopPropagation();
}
onclick="showCalendarControl(this);stopProp();"
I corrected like this now there is  no error but still do not work in FF

onclick="showCalendarControl(this);stopProp;"
try this
function stopProp(e) {
  var event = e || window.event;
  if (event.stopPropagation) {
    event.stopPropagation();
  } else {
    event.cancelBubble = true;
  } 
}

Open in new window

now it says event is undefined, IE works
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial