jquery - Hover for class in two tables? -


<table border=2>     <tr class="here1 yes">         <td>aaa1</td><td>bbb1</td>     </tr>     <tr class="here2 yes">         <td>aaa2</td><td>bbb2</td>     </tr>      <tr class="here55 yes">         <td>aaa3</td><td>bbb3</td>     </tr> </table>   <table border=2>     <tr class="here1 yes">         <td>ccc1</td><td>ddd1</td>     </tr>     <tr class="here2 yes">         <td>ccc2</td><td>ddd2</td>     </tr>      <tr class="here55 yes">         <td>ccc3</td><td>ddd3</td>     </tr> </table>   .yes:hover {    background-color: red; } 

live: http://jsfiddle.net/kzzw8/

the above table generated following php:

 `<tr class="here<? echo $i ?> yes">` 

i mouseover on tr.here1 turn contents of tr.here1 red subordinate td in group: (aaa1, bbb1, ccc1, ddd1) regardless of table in.

i believe can use jquery this. possible?

http://jsfiddle.net/kzzw8/1/

$('tr').hover(function() {     var cls = $(this).prop('class').match(/here\d+/);     if (cls) {         $('.' + cls).addclass('hover');     } }, function() {     $('.yes.hover').removeclass('hover'); });​ 

so on hover event here* class , apply class .hover rows same class. on hover out - remove additionally added classes


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -