I have a div with id = "images".
The div contains some images that are wrapped in an anchor tag without a target attribute.
I would like to insert a script into my page, which pulls out a link to each of these anchor elements and declares the target = "new" attribute (at runtime) so that with each click they open in a new window.
I donβt want to hardcode the target attributes in the attached tags. This solution is for deployment after deployment. I do not use jquery in this application.
<div id="images"><a href=""><img src="foo.png" /></a>...etc </div>
source share