Mega Code Archive

 
Categories / JavaScript Tutorial / JQuery
 

Click to change DIV tag color

< html>   <head>     <style>       div { width:50px; height:40px; margin: 5px; float:left;background:red; }     </style>     <script type="text/javascript" src="js/jquery-1.3.2.js"></script>     <script type="text/javascript">     $(document).ready(function(){            $("div:visible").click(function () {              $(this).css("background", "yellow");           });     });     </script>   </head>   <body>         <div></div>       <div style="display:none;"></div>       <div></div>       <div style="display:none;"></div>   </body> </html>