Dynamically Insert Links Inside Span Tag Using Javascript
I have this: <span class="image"><img src="something.jpg"></span> I want to transform it to that using javascript: <span class="image"><a href="domain"><img src="something.jpg"></a></span> It has to be done using javascript in order to hide the affiliate links. I have tried this script but it seems not to work: function changespan() { find all <span> tags; for each <span> with class="image"{ URL = "http://domain.com" Create new link to URL; insert link into <span>; } } The function is uploaded in file script.js and I load it in this fashion: <script type="text/javascript" src="script.js"><