Sets src attribute from title attribute on the image. : attr « jQuery « JavaScript DHTML
- JavaScript DHTML
- jQuery
- attr
Sets src attribute from title attribute on the image.
<html>
<head>
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("img").attr("src", function() {
return "/images/" + this.title;
});
});
</script>
</head>
<body>
<body>
<img title="a.gif"/>
</body>
</html>
Related examples in the same category