<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $("input").click(function(){ $("span").append("<img src=\"img/before.png\">"); }); $("img").live("mouseover",function(){ $(this).attr("src","img/after.png"); }).live("mouseout",function(){ $(this).attr("src","img/before.png"); }); }); </script> <style> img{ cursor:pointer; margin:0 5px 5px 0; } </style> </head> <body> <p><input type="button" value="click"></p> <span></span> </body> </html>