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_50 by HTTrack Website Copier/3.x [XR&CO'2010], Thu, 01 Sep 2011 14:44:53 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"); $("#result").html("That div is <span>" + color + "</span>."); $("#result").css("color", color); }); }); </script> <style> div { width:60px; height:60px; margin:5px; float:left; } </style> </head> <body> <p>Click on any square:</p> <span id="result"> </span> <div style="background-color:blue;"></div> <div style="background-color:rgb(15,99,30);"></div> <div style="background-color:#123456;"></div> <div style="background-color:#f11;"></div> </body> <!-- Mirrored from www.tutorialspoint.com/cgi-bin/practice.cgi?file=jquery_50 by HTTrack Website Copier/3.x [XR&CO'2010], Thu, 01 Sep 2011 14:44:53 GMT --> <!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8"><!-- /Added by HTTrack --> </html> |