Monday, 15 March 2010

jquery - add and remove class on hover with selecting multiple td classes? -



jquery - add and remove class on hover with selecting multiple td classes? -

could help me website is: zenart website should happen add together class of highlight on hover every column of table. have added same class every td in each corresponding create columns. alot! jquery code:

$(document).ready(function() { var = $ a('.column1, .column2, .column3, .column4, .column5').hover( function(){ a(this).addclass('highlight') }, function(){ a(this).removeclass('highlight') }) });

this should work you. have extract name of class classes , see class xcolumn selected. , apply style class.

$(".1column, .2column, .3column, .4column, .5column").hover( function () { var classes = $(this).attr('class'); var n = classes.indexof("column"); var classname = "." + classes.substring((n-1),(n+7)); $(classname).addclass("highlight"); }, function () { var classes = $(this).attr('class'); var n = classes.indexof("column"); var classname = "." + classes.substring((n-1),(n+7)); $(classname).removeclass("highlight"); } );

jquery table hover

No comments:

Post a Comment