Set all link targets for a page

Posted by zac on Stack Overflow See other posts from Stack Overflow or by zac
Published on 2010-05-14T03:22:21Z Indexed on 2010/05/14 3:24 UTC
Read the original article Hit count: 201

Filed under:
|
|

I have links that are dynamically generated and I need to set the target for all of them. How could I do this with javaScript. I found something that looks like it should work using jQuery..

$("#myDiv a").attr('target', '_top');

but I dont want to use a library for this and I imagine a couple of lines of javaScript would take care of it... I just dont know how to write it.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about links