Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
166
rated 0 times [  172] [ 6]  / answers: 1 / hits: 93491  / 13 Years ago, fri, august 5, 2011, 12:00:00
<img src=../img/arnold.png alt=Arnold>


How do I get with jQuery absolute path of this image?



img.attr(src) gives me just ../img/arnold.png, should give something like http://site.com/data/2011/img/arnold.png (full url).


More From » jquery

 Answers
54
alert( $('img')[0].src );


this might do the trick... but not sure about cross browser....



demo in here



also try prop of jQuery 1.6..



alert( $('img').prop('src') );


demo here


[#90806] Wednesday, August 3, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
victorr

Total Points: 193
Total Questions: 86
Total Answers: 105

Location: Pitcairn Islands
Member since Thu, Jun 24, 2021
3 Years ago
victorr questions
Fri, Nov 13, 20, 00:00, 4 Years ago
Sat, Jul 25, 20, 00:00, 4 Years ago
Thu, Jun 11, 20, 00:00, 4 Years ago
;