Edit Code in left box and click Show Results button to see the result. | Home
<html> <!-- Mirrored from www.tutorialspoint.com/cgi-bin/practice.cgi?file=jquery_53 by HTTrack Website Copier/3.x [XR&CO'2010], Thu, 01 Sep 2011 14:44:56 GMT --> <!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8"><!-- /Added by HTTrack --> <head> <title>the title</title> <script type="text/javascript" src="../jquery/jquery-1.3.2.min.js"></script> <script type="text/javascript" language="javascript"> $(document).ready(function() { $("div").click(function () { var color = $(this).css("background-color"); var height = $(this).innerHeight(); $("#result").html("Inner Height is <span>" + height + "</span>."); $("#result").css({'color': color, 'background-color':'gray'}); $("#result").height( height ); }); }); </script> <style> #div1{ margin:10px;padding:12px; border:2px solid #666; width:60px;} #div2 { margin:15px;padding:5px; border:5px solid #666; width:60px;} #div3 { margin:20px;padding:4px; border:4px solid #666; width:60px;} #div4 { margin:5px;padding:3px; border:3px solid #666; width:60px;} </style> </head> <body> <p>Click on any square:</p> <span id="result"> </span> <div id="div1" style="background-color:blue;"></div> <div id="div2" style="background-color:pink;"></div> <div id="div3" style="background-color:#123456;"></div> <div id="div4" style="background-color:#f11;"></div> </body> <!-- Mirrored from www.tutorialspoint.com/cgi-bin/practice.cgi?file=jquery_53 by HTTrack Website Copier/3.x [XR&CO'2010], Thu, 01 Sep 2011 14:44:56 GMT --> <!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8"><!-- /Added by HTTrack --> </html> |