Wednesday, 15 April 2015

javascript - on dom ready append html element using jquery -



javascript - on dom ready append html element using jquery -

i have legacy database holds beside rest html source used client render page snippets. want fetch images within #mainnewsbody .news p , add together link image rel='superbox[image]'

now it's

<img src="http://www.mysite.com/images/dscf1087.jpg" /> , should

<img src="http://www.mysite.com/images/dscf1087.jpg" rel='superbox[image]'/>

how can achive using jquery on dom ready?

thanks everyone.

$(function(){ $('#mainnewsbody .news img').attr('rel', 'superbox[image]'); });

javascript jquery

No comments:

Post a Comment