Last active
December 2, 2020 07:33
-
-
Save gander/df5972635016c3013782f27bcc4cb800 to your computer and use it in GitHub Desktop.
convert text into links in table cells
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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