web - Image change on click in jquery -
am using below code. have 2 images. plus , minus. on click of plus image should change minus. here image not changing.
<script type="text/javascript"> $(document).ready(function () { $("#plus").click(function () { if ($('#divreg').is(":hidden")) { $('#divreg').show(500); document.getelementbyid('plus').src = "~/styles/min.jpg"; } else { $("#divreg").hide(500); document.getelementbyid('plus').src = "~/styles/plus.jpg"; } }); });
without seeing html via jsfiddle or similar see 1 problem. using server url as:
~/styles/min.jpg
this parsed asp.net runtime , not jquery image path incorrect. change path test , see if works. if not, have other errors , should create test case on jsfiddle more help.
Comments
Post a Comment