Reputation: 14205
I have legacy database with holds beside rest html source which is used by a client to render some page snippets. I want to fetch all images inside #mainNewsBody .news p
and to add link to that image rel='superbox[image]'
Now it's
<img src="http://www.mysite.com/images/DSCF1087.JPG" />
and it should be
<img src="http://www.mysite.com/images/DSCF1087.JPG" rel='superbox[image]'/>
how can I achive this using jquery on dom ready?
Thanks everyone.
Upvotes: 0
Views: 298
Reputation: 74166
$(function(){
$('#mainNewsBody .news img').attr('rel', 'superbox[image]');
});
Upvotes: 1
Reputation: 7892
$(document).ready(function(){
$('#mainNewsBody .news p img').attr('rel', 'superbox[image]');
});
Upvotes: 0
Reputation: 21050
$(document).ready(function() {
$('#mainNewsBody .news p img').attr("rel", "superbox[image]");
});
Upvotes: 0