I try this code to change a img image and it work in localhost but is dosent work on my host .
these are the way that i treid:
$("#btnChangImg").click(function () {
$("#Div").html('<img id="img" alt="" src="/Test/2.jpg" />');
});
And this a another way that i treid:
$("#btnChangImg").click(function () {
$("#img").attr("src", "/Test/2.jpg");
});
src of the #img is “/Test/1.jpg” now.and it should be change to “/Test/1.jpg”
and this is my HTML:
<form id="form1" runat="server">
<div id="Div">
<img id="img" alt="" src="/Test/1.jpg" />
</div>
<input id="btnChangImg" type="button" value="button" />
</form>
If you are using ASP.NET or something like that it might be possible that your id is changed when the page is rendered because your code is correct
Look at the fiddle here http://jsfiddle.net/KBWk8/