JavaScript: Update Link Targets to _blank With jQuery

2/8/2015 6:58:46 PM

The following code can be called to update the targets of a set of links.

function update_link_targets(selector)
{
	$(selector).attr("target", "_blank");
}

//all links
update_link_targets("a");

//all links by class
update_link_targets(".my_links");

//link by Id
update_link_targets("#lnkExternal");