1 <!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">2 <HTMLxmlns= "http://www.w3.org/1999/xhtml">3 <Head>4 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />5 <title>Untitled Document</title>6 <Scripttype= "Text/javascript"src= "Http://code.jquery.com/jquery-1.7.2.min.js"></Script>7 <Script>8 9 Ten $(function(){ One A //$ (' div '). Find (' H3 '). EQ (2). CSS (' background ', ' red '); - - /*var odiv = $ (' div '); the var aH3 = odiv.find (' h3 '); - var oh3_2 = Ah3.eq (2); - oh3_2.css (' Background ', ' red ');*/ - + $('Div'). Find ('H3'). EQ (2). CSS ('background','Red'). End (). EQ (4). CSS ('background','Green'). End (). end (). CSS ('Border','1px Red Solid'); - //Event Bindings + $('. txt'). Bind ('Focus', {msg1:'I am MSG1', MSG2:'I'm msg 2 .'},function(e) { A $('#divTip'). Show (). HTML (E.DATA.MSG1); at }); - }); - - </Script> - </Head> - in <Body> - <Div> to <H3>11111</H3> + <H3>22222</H3> - <H3>33333</H3> the <H3>44444</H3> * <H3>55555</H3> $ </Div>Panax Notoginseng - <Div>Name:<inputtype= "text"class= "txt" /></Div> the <DivID= "Divtip"class= "Clstip"></Div> + </Body> A </HTML>
jquery's chained operations and event bindings