Reputation: 15043
I'm just getting started with jQuery, having a little trouble.
Got a table of thumbnails, and I want each cell to be highlighted when I hover over the picture inside it. Got that part working. But I also want the picture inside the cell not to have an underline - this is inherited from the stylesheet a:hover{text-decoration:underline}
. This is where I'm stuck, I don't think I'm setting the right thing.
I need to use inline styles, so my jQuery looks like:
$('[name*=thumb]').hover(
function () {
//as we hover over an item, change it's background, attempt to vaquish pesky underline
$('#' + $(this).attr('id').replace('thumb', 'thumbcontainer')).css('background-color', '#cccccc');
$('#' + this).css('text-decoration', 'none'); //doesn't work : (
},
function () {
//fix bgs of items we're not hovering on
$('#' + $(this).attr('id').replace('thumb', 'thumbcontainer')).css('background-color', '#ffffff');
}
);
My HTML looks like this :
<td name="thumbcontainer8" id="thumbcontainer8"><a href="#" name="thumb8" id="thumb8"><img src="..." /></a></td>
<td name="thumbcontainer9" id="thumbcontainer9"><a href="#" name="thumb9" id="thumb9"><img src="..." /></a></td>
Upvotes: 0
Views: 1123
Reputation: 15516
Wouldn't this rule in your stylesheet do the trick?
a:hover img{text-decoration:none}
Upvotes: 3