February 27, 2009

Change Table Border Color On Hover using jQuery




Here'a a very simple way to change the Table/Grid/GridView Border Color on Hover. This assumes that your control renders the <table> tag


<html xmlns="http://www.w3.org/1999/xhtml">


<head runat="server">


    <title>Border Color on Hover</title>


    <script src="Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>


 


 <script type="text/javascript">


     $(document).ready(function() {


         $(".someClass").hover(


      function() {


         $(this).css({ "border": "Solid Brown 1px" });


      },


      function() {


          $(this).css({ "border": "" });


      });


     });


 </script>   


</head>


<body>


    <form id="form1" runat="server">                 


        <table id="tblOuter" class="someClass" style="width:50%">


        <tr>  


            <td>Row 0, Column 0</td>


            <td>Row 0, Column 1</td>


            <td>Row 0, Column 2</td>


        </tr>


        <tr>  


            <td>Row 1, Column 0</td>


            <td>Row 1, Column 1</td>


            <td>Row 1, Column 2</td>


        </tr>


        <tr>  


            <td>Row 2, Column 0</td>


            <td>Row 2, Column 1</td>


            <td>Row 2, Column 2</td>


        </tr>


       </table>


    </form>


</body>


</html>




'Like' us on our FaceBook page if you find this blog useful. Thanks!


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

1 Response to "Change Table Border Color On Hover using jQuery"
  1. Anonymous said...
    November 10, 2011 6:59 AM

    Garbage. This can be done in pure CSS.

 

Copyright © 2009-2012 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions