简体   繁体   English

从内部 html 中提取表行中的 URL 数据,试图弄清楚如何让它在单击时在新选项卡中打开 URL

[英]Url data in table row being pulled from Inner html, trying to figure out how to make it open the URL in a new Tab on click

I have some code below which pulls a URL data from a csv that is linked and places it inside a table row and converts it to a URL link on each row of the table,我在下面有一些代码,它从链接的 csv 中提取 URL 数据并将其放置在表格行中,并将其转换为表格每一行上的 URL 链接,

What I am trying to figure out is how to make it also open the URL in a new Tab of the browser.我想弄清楚的是如何让它也能在浏览器的新标签页中打开 URL。

$('td:nth-child(13)').html(function() {
    return "<a href='" + this.innerHTML + "'>Local Time URL</a>";
  });

i have tried我试过了

$('td:nth-child(13)').html(function() {
    return "<a href='" + this.innerHTML + " target="_blank"'>Local Time URL</a>";
  });

but that then failed to load any of the csv data into the table但随后未能将任何 csv 数据加载到表中

Nevermind i figured it out when i looked at this code written here I realised this was the answer没关系,当我看到这里写的代码时我想通了,我意识到这就是答案

return "<a href='" + this.innerHTML + "'target='_blank'>Local Time URL"; return "<a href='" + this.innerHTML + "'target='_blank'>本地时间 URL";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM