有没有人知道如何在鼠标悬停在行上时将边框添加到具有不同背景颜色的表格行的边框?
我已经能够改变行的背景颜色:
- $(document).ready(function() {
- $(function() {
- $('.actionRow').hover(function() {
- $(this).css('background-color','#FFFF99');
- },function() {
- $(this).css('background-color','#FFFFFF');
- });
- });
- });
但是我无法添加边框颜色.我意识到边框不能直接应用到表行标签,但我希望有人知道一些jQuery巫术魔法,可以在所选行中找到表格单元格,并为创建边框应用一些样式.
谢谢!
解决方法
- $(function() {
- $('tr').hover(function() {
- $(this).css('background-color','#FFFF99');
- $(this).contents('td').css({'border': '1px solid red','border-left': 'none','border-right': 'none'});
- $(this).contents('td:first').css('border-left','1px solid red');
- $(this).contents('td:last').css('border-right','1px solid red');
- },'#FFFFFF');
- $(this).contents('td').css('border','none');
- });
- });