I want when I click in the image I get the new but after 1 second I want to get the default. I added the function setTimeout(), but after one second I still have the same image (pressed.svg)
This is all my code :
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script language='Javascript'>
$(document).ready(function(){
$("#myImage").on("click",function() {
$(this).attr("src","images/pressed.svg");
setTimeout(function() {
$(this).attr("src","images/normal.svg");
},1000);
});
});
</script>
</head>
<body>
<img src="images/normal.svg" id="myImage">
</body>
</html>