function datePicker(event)
{
//do something`enter code here`
}
document.onclick=function() {
//do something
}
When I call datePicker() function I want to prevent the calling second method . How to do that ?
function datePicker(event)
{
//do something`enter code here`
}
document.onclick=function() {
//do something
}
When I call datePicker() function I want to prevent the calling second method . How to do that ?
Use event.stopPropagation()
to stop the event bubbling up to the document
click listener:
function datePicker(event)
{
event.stopPropagation();
}
You can also use event.stopImmediatePropagation()
to stop sibling elements receiving the event too, if necessary: jquery: stopPropagation vs stopImmediatePropagation
jQuery Example with IE8 catered for: http://jsfiddle.net/kHT2A/2/