In javascript , e.preventDefault() will always prevent the event from occurring which is default event.
It simply means that If any method is called, then the default action of that particular event will not be triggered.
Note: - We can't pass the parameter along with this javascript method.
Example:
jQuery(document).ready(function(){
$('a.link').click(function (e) {
e.preventDefault();
});
});
e.stopPropagation() in javascript always prevent the event from bubbling.
It simply means that If any method is called, then this method prevents that event from bubbling up over the DOM(Document object modal) tree.
Note: - We can't pass the parameter along with this javascript method as well.
Example:
jQuery(document).ready(function(){
$('a.link').click(function (e) {
e.stopPropagation();
});
});
0 Comment(s)