Reputation: 146
I am using jquery for changing image path but its not working for asp.net dynamic content
The jquery function is
$('img.selection').click(function () {
this.src = 'images/selected_img.png';
});
This function is not post backing in to the C#, so am not getting changed image values.
Please help me...
Upvotes: 1
Views: 1103
Reputation: 1148
The problem might lie in that asp controls id's are changed when sent to the client.
If this is the case you can fix this in to ways
Set the controlidmode to static on your control in asp.
get the id of the control with jQuery with selectors: $('[id$=theidnameofthecontrol]').click(function () ....
Also you do not need postback. If you provide the new url with jQuery, it should load this without having to postback.
Upvotes: 0
Reputation: 15866
try this :
$(this).attr("src", 'images/selected_img.png');
Upvotes: 1