Click here to Skip to main content
15,892,797 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a table that column 2 is a picture.

i want while click on row change pic.

not run code :
JavaScript
$("tr").click(function () {

            $(this).find("td:gt(0)").attr("src", "~/content/images/img/mail_open.gif";);


           });
Posted
Updated 10-Apr-15 5:12am
v3
Comments
Sajith Dilhan 9-Apr-15 2:43am    
did you check for any script errors in the page ?
ZurdoDev 10-Apr-15 11:23am    
Just debug it. You have it setup to run on click of tr which I'm not sure works since tr isn't an actual object, really. You may have to put the click on td instead.

1 solution

The <td> element does not have a src attribute. You probably intended to find the <img> element within the <td>:
JavaScript
$(this).find("td:eq(1) img").attr("src", "...");
 
Share this answer
 

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