How to get all anchors to open in new window with inappbrowser?

I’m using this:

document.onclick = function (e) {
e = e || window.event;
var element = || e.srcElement;

    if (element.tagName == 'A') {, "_blank", "location=no");
        return false;

But I need to get the anchor from a specifically tag like or any id

thanks., "_system")

Also, i wouldnt use that window hack. It’s probably best to create a directive for this.

Thanks Ash, but how can I create a directive for this?