Print? In the online example, $ (". B"). live ("click", function (event) {}is used. jquery automatically processes live and prevents event bubbles. Change to bind to pass the experiment.
In the online example, $ (". B"). live ("click", function (event) {}is used. jquery automatically processes live and prevents event bubbles. Change to bind to pass the experiment.
[Html]
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<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 ()
})
});
</Script>
</Head>
<Body>
<Div id = "temp"> </div>
<Div class = "B" style = "background: #3ff333"> wrapwrapwrapwrapwrapwrap
<Div style = "background: # ffff11" class = "B"> This is announcement Title 1 </div>
<Div style = "background: # ffff11" class = "B"> This is announcement Title 2 </div>
<Div style = "background: # ffff11" class = "B"> This is announcement Title 3 </div>
<Div style = "background: # ffff11" class = "B"> This is announcement Title 4 </div>
Wrapwrapwrapwrapwrapwrapwrap
</Div>
</Body>
</Html>
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<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 ()
})
});
</Script>
</Head>
<Body>
<Div id = "temp"> </div>
<Div class = "B" style = "background: #3ff333"> wrapwrapwrapwrapwrapwrap
<Div style = "background: # ffff11" class = "B"> This is announcement Title 1 </div>
<Div style = "background: # ffff11" class = "B"> This is announcement Title 2 </div>
<Div style = "background: # ffff11" class = "B"> This is announcement Title 3 </div>
<Div style = "background: # ffff11" class = "B"> This is announcement Title 4 </div>
Wrapwrapwrapwrapwrapwrapwrap
</Div>
</Body>
</Html>
Add or not in the above Code
[Html]
Event. stopPropagation (); the effect is different.
Event. stopPropagation (); the effect is different.