Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  5] [ 1]  / answers: 1 / hits: 38461  / 12 Years ago, wed, may 2, 2012, 12:00:00

I've put a google map in a page and it makes lots of img tags without the alt attribute, how can I add the alt for each img in a div in jquery, what's I gotta make instead of :



$('#map_canvas > img[alt]').attr('image');


Thanks


More From » jquery

 Answers
134

To set alternative text to all the images:



$('#map_canvas > img').attr('alt', 'Alternative text');


To set alternative text to images that does not have alt attribute:



$('#map_canvas > img:not([alt])').attr('alt', 'Alternative text');

[#85849] Tuesday, May 1, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eanskylerg

Total Points: 524
Total Questions: 107
Total Answers: 100

Location: Colombia
Member since Mon, May 2, 2022
2 Years ago
;