Solution
Use
jQuery[
^], which makes life easier.
Code
$(document).ready(function () {
$('.imgh')
.mouseover(function () {
$(this).attr("src", "http://taditdash.files.wordpress.com/2014/01/tadit-dash.jpg");
})
.mouseout(function () {
$(this).attr("src", "http://s.codeproject.com/App_Themes/CodeProject/Img/logo250x135.gif");
});
});
NOTE:
- Mark that I have assigned the Image URLs to the source attribute.
- To run jQuery, you have to include the jQuery file in the head section of your WebPage.
- You can download from here[^].
Else you can directly use the online latest version like...
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
Demo
[Demo] Change Image Source on Mouse Hover[
^]