I’m trying to do a popup via JavaScript to popup the IMG URL which is what the img tag is defining through src=
I’m not sure how to call it.
alert(document.getElementById("my_image").src);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s better to use the
getAttribute()function:Using
getAttribute()is more suitable for your application than simply usingelement.src, since it will return the explicit defined value inside the attribute, rather than the parsed value.See the comparison here > http://jsfiddle.net/9dAjL/