jQuery: Reading an alt attribute
The jQuery Code START
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
function getAlt() {
alert($("img").slice(1, 2).attr("alt"));
}
</script>
</head>
<body>
<h1>jQuery: Reading an alt attribute</h1>
<img src="images/image1.jpg" alt="This is an image of flowers."></img>
<img src="images/image2.jpg" alt="This is also an image of flowers."></img>
<br>
<form action="">
<input type = "button" value="1st IMG get alt attribute" onclick="getAlt()"></input>
<input type = "button" value="2nd IMG get alt attribute" onclick="getAlt2()"></input>
<input type = "button" value="3rd IMG get alt attribute" onclick="getAlt3()"></input>
</form>