Examples on the Web are $ (". B"). Live ("Click", Function (event) {}, jquery automatically handles live, preventing event bubbling. If you change it to bind, the experiment will pass.
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Untitled Document </title>
<script type= "Text/javascript" src= "Http://www.css88.com/tool/css3Preview/jquery-1.4.2.min.js" ></script >
<script type= "Text/javascript" >
$ (function () {
$ (". B"). Bind ("click", Function (event) {
$ (this). CSS ("Color", "#FF3300");
Event.stoppropagation ()//comment out, <span style= "Background-color:rgb (255,255,255)" > effect is not the same. </SPAN>
})
});
</script>
<body>
<div id= "Temp" ></div>
<div class= "B" style= "background: #3ff333" >wrapwrapwrapwrapwrapwrapwrap
<div style= "background: #ffff11" class= "B" > This is the Bulletin title 1</div>
<div style= "background: #ffff11" class= "B" > This is the Bulletin title 2</div>
<div style= "background: #ffff11" class= "B" > This is the Bulletin title 3</div>
<div style= "background: #ffff11" class= "B" > This is the Bulletin title 4</div>
Wrapwrapwrapwrapwrapwrapwrap
</div>
</body>
Add or not in the above code
Copy Code code as follows:
Event.stoppropagation ();