| <! 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> <Title> jquery dynamically changes the div width and height </title> <Script type = "text/javascript" src = "jquery/jquery-1.11.2.min.js"> </script> </Head> <Body> <Div> <Input id = "addwidthkeleyi" value = "increase the width" type = "button"/> <Input id = "cecewidthkeleyi" value = "width" type = "button"/> <Input id = "addheightkeleyi" value = "add height" type = "button"/> <Input id = "ceceheightkeleyi" value = "" type = "button"/> Click the button and pay attention to the changes in the width of the div below </div> <Div style = "border: 1px solid #999; width: 200px; height: 200px" id = "keleyidiv"> </div> <Script type = "text/javascript"> $ ("# Addwidthke" + "leyi"). on ("click", function (){ $ ("# Keleyidiv"). width ($ ("# keley" + "idiv"). width () + 50 ); }); $ ("# Performancewidthk" + "eleyi"). on ("click", function (){ $ ("# Keleyidiv"). width ($ ("# kel" + "eyidiv"). width ()-50 ); }); $ ("# Addheightkele" + "yi"). on ("click", function (){ $ ("# Kel" + "eyidiv"). height ($ ("# keleyidiv"). height () + 50 ); }); $ ("# Performanceheightkeley" + "I"). on ("click", function (){ $ ("# Keleyidiv"). height ($ ("# keleyidiv"). height ()-50 ); }); </Script> </Body> </Html> |