Skip to content

Instantly share code, notes, and snippets.

@gander
Last active December 2, 2020 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gander/df5972635016c3013782f27bcc4cb800 to your computer and use it in GitHub Desktop.
Save gander/df5972635016c3013782f27bcc4cb800 to your computer and use it in GitHub Desktop.
convert text into links in table cells
jQuery(() =>
jQuery('td').filter(function() {
return jQuery(this).text().match(/^https?:\/\/.+/);
}).each(function() {
const $this = jQuery(this);
$this.html(jQuery('<a>', {
href: $this.text(),
rel: 'noopener noreferrer',
target: '_blank'
}).text($this.text()));
})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment