In this example, I will show you how to change the image src attribute using jquery. The attr (name, value) method is used to set the named attribute, src and value. The following code is used to set the src using jQuery.
<img id="profilePic" src="~/images/hero.jpg" />
$("#profilePic").attr("src", "~/images/john.jpg");