[jQuery] Re: tr not applying CSS
Does the class that you are applying to your set the background- color on the itself? If so, you might want to try modifying your CSS a bit to apply the background-color to the elements in your like: tr.newClass td { background:#ff; } Hope this helps. On Dec 20, 4:31 am, JQueryProgrammer <[EMAIL PROTECTED]> wrote: > I have a table that displays n rows based on the records from the > database. For a particular row that gets displayed n times, I have > assigned a name to the row. The row already has some CSS applied to > it. But I want that whenever I take the mouse over the row, the new CC > should get applied and the on mouse out the old CSS should reapply. > > I tried the code as: > > $("tr[name='myRowName').hover( > function() { > $(this).addClass("newClass"); > }, function() { > $(this).removeClass("newClass"); > } > ); > > But it does not work. Can anyone let me know.
[jQuery] Re: tr not applying CSS
Sometimes the order of your CSS definitions make a difference. If "newClass" is defined before the other CSS being applied you can try to move the newClass definition below. Next, make sure your selector is working. Try something like $(this).css("background-color", "#f00"); If you don't see that cell go red, then you know your selector isn't quite right. Not a great help, I'm sure, but hope it gets you going. Good luck. Shawn JQueryProgrammer wrote: > I have a table that displays n rows based on the records from the > database. For a particular row that gets displayed n times, I have > assigned a name to the row. The row already has some CSS applied to > it. But I want that whenever I take the mouse over the row, the new CC > should get applied and the on mouse out the old CSS should reapply. > > I tried the code as: > > $("tr[name='myRowName').hover( > function() { > $(this).addClass("newClass"); > }, function() { > $(this).removeClass("newClass"); > } > ); > > But it does not work. Can anyone let me know.
[jQuery] Re: tr not applying CSS
Have you tried giving your row a specific class instead of using name? eg. $('tr.myRowClass').hover( function() { $(this).addClass("newClass"); }, function() { $(this).removeClass("newClass"); } ); On Dec 20, 4:31 am, JQueryProgrammer <[EMAIL PROTECTED]> wrote: > I have a table that displays n rows based on the records from the > database. For a particular row that gets displayed n times, I have > assigned a name to the row. The row already has some CSS applied to > it. But I want that whenever I take the mouse over the row, the new CC > should get applied and the on mouse out the old CSS should reapply. > > I tried the code as: > > $("tr[name='myRowName').hover( > function() { > $(this).addClass("newClass"); > }, function() { > $(this).removeClass("newClass"); > } > ); > > But it does not work. Can anyone let me know.