Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a table mytable1 contains 3-rows and td elements. The below code working fine when I have 6-rows. But when I have 3 rows it's not working. Any guidences will be helpful.

Note : The below code used, When the user mouseover the table images, the cursor will change.

My Codes
Javascript
$(document).ready(function() {
    $("#mytable1 tr:has(td)").mouseover(function(e) {
        $(this).css("cursor", "pointer");
    });
 });

HTML
<table id="mytable1" table-layout="fixed" width="100%" style="margin-top: 0px; float:top;"> 
      <tr>
         <td><span>Design Code : A0001</span></td>
         <td><span>Design Code : A0002</span></td>
      </tr>
      <tr>
         <td><a><img src="Images/Img1.jpg"></a></td>
         <td><a><img src="Images/Img2.jpg"></a></td>
      </tr>
      <tr>
         <td><span>Colour : Wite</span></td>
         <td><span>Colour : Red</span></td>
      </tr>
 </table>


What I have tried:

I try to change the cursor when the user mouseover on the Images, but I wondered once I have 6 rows like the similar datas working good. but not on 3-rows...
Posted
Comments
Richard Deeming 16-Sep-20 11:11am    
Your code works fine for me:
Edit fiddle - JSFiddle - Code Playground[^]
Paramu1973 17-Sep-20 3:55am    
Thank Richard, I have pages like Index, AboutUs, ContactUs. While I used the above code in Index working good. But when I wish to use the same code in another contactus page it's not working good. Can u have a try in other pages also...
Richard Deeming 17-Sep-20 5:28am    
The action you're using is irrelevant. So long as the jQuery reference is included properly, the script will work in any page.

Check your browser's developer console for errors.
Sandeep Mewara 17-Sep-20 5:58am    
What do you mean by not working good? What is happening in another page where it is not working compared to page where it is working?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900