I have following hyperlink in asp.net:
<asp:HyperLink ID="a" runat="server" ImageUrl="1.png" NavigateUrl="https://google.com/"></asp:HyperLink>
I want to change ImageUrl through jquery to 2.png. I am trying this but it is not working:
$("#a").attr("ImageUrl", "2.png");
A couple things here…
I have found that you can’t select an element this way if you include the runat attribute. You will need to reference the object like this…
That should get you the correct object. Now, the asp:HyperLink saves as an anchor with an image attached. So you can reference and change the source like this.