Set Image URL title alt
<html> <head> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("img").attr({ src: "http://java2s.com/style/logo.png", title: "java2s.com", alt: "Logo" }); $("div").text($("img").attr("alt")); }); </script> </head> <body> <body> <img /> <div></div> </body> </html>