I have an image which is as below
<img alt="" style="cursor: pointer" src="images/plus.png" width="20" height="20" />
And I'm changing this img src alternatively by using the below code
1. $("[src*=plus]").click( function () {
$(this).attr("src", "images/minus.png");
});
2. $("[src*=minus]").click(function () {
$(this).attr("src", "images/plus.png");
});
The first function is working as expected- when I click on the button for the first time the image is changing to 'minus',but when I click on this changed 'minus' image the function call is going again to the same first function. What am I doing wrong here. Please help.
Referred following link Changing the image source using jQuery