1. Block the default event for a form, or the default event "Event.preventdefault ()" That slides in the HTML5 Chinese file, blocking the default event for the element.
Demo1-1: Block element class default event
<a href= "http://www.baidu.com" target= "_black" > Baidu </a>
Document.getelementbytagname ("a"). AddEventListener ("click", Function (e) {e.preventdefault ()},false);
Click on the link when the normal will occur jump, but now we have blocked its default event, that is, jump events, then will not jump to Baidu.
DEMO1-2: Block document default event in Mobile end
Document.ontouchmove = function (EV) {
Ev.preventdefault ();
};
=========
2 、--block element bubbling event "(ie:) ev.cancelbubble = true; (ff:) ev.stoppropagation (); 】;
Demo
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">