Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anotheremily/340481 to your computer and use it in GitHub Desktop.
Save anotheremily/340481 to your computer and use it in GitHub Desktop.
/**
* creates javascript that causes links with the class newWindow to
* open in a new browser window
* requires jquery
*/
function createLinkTargets() {
$('a.newWindow').each(function() {
$(this).on('click', function () {
var newWindow = window.open($(this).attr('href'));
return false;
});
});
}
$(document).ready(function () {
createLinkTargets();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment