Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
jQuery Open Files In New Window
// Regex via
// jQuery Filter idea via
jQuery(function() {
jQuery('a').filter(function() {
return this.href.match(/\.([0-9a-z]+)(?:[\?#]|$)/i);
}).prop('target', '_blank');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.