0

Suppose i have

<html>    
<body>   
<a href="www.example.com" ><img src="www.example.com/gc_bt1.jpg" alt="Home page..." name="Image1" width="150" height="27" border="0" id="Image1" /></a>    </body>    </html>

how can i retrieve the alt value from the image tag.

Johnson Smith
  • 55
  • 1
  • 1
  • 7

2 Answers2

0

you can use javascript for that

var x = document.getElementsByName("Image1").alt;
Dinesh
  • 4,066
  • 5
  • 21
  • 35
-1

if you are using Jquery

var alt=$("a>img").attr('alt')

will give you the alt tag

helion3
  • 34,737
  • 15
  • 57
  • 100
Learner
  • 221
  • 2
  • 10