Make all links in a dataTable open in a new tab/window?
Make all links in a dataTable open in a new tab/window?
mchugh
Posts: 2Questions: 1Answers: 0
I've tried all the usual jquery methods of doing this, but none seem to affect the links within a DataTable.
Is there a known way of doing this?
I'm using the "Inline Google Spreadsheet Viewer" plugin for WordPress, which uses DataTables for display.
I have a column of URLS, which are made links, but want to add a target="_blank" to all or otherwise open a new tab/window when the links are clicked.
This discussion has been closed.
Answers
How are you creating the URLs? That would be the obvious time to add the "target" attribute.
The "Inline Google Spreadsheet Viewer" plugin for WordPress automatically makes a column of URLs into HTML links, but there's no target.
I've also posted in its support forum for a possible solution as well.
I was mainly just wondering if anyone knew of a way via JS of applying the targets after the fact that would work, if all else fails.
This isn't something that DataTables will address in that case.
However, you could use something like:
That's really more of a generic Javascript question for StackOverflow kind of thing rather than DataTables specific though.
Allan