Question: I am making a table row clickable but once clicked I want to open a new tab. I tried using `data-target` but that didn't work.

```
<tr class="table-row" data-href="mypage.php" data-target="_blank"></tr>

<script type="text/javascript">
    $(document).ready(function ($) {
        $(".table-row").click(function () {
            window.document.location = $(this).data("href");
        });
    });
</script>

```

Answer: 
This should work. It will open new tab;

HTML

```
  <table>
        <tr class="table-row" data-href="mypage.php" data-target="_blank">
          <td>something</td>
        </tr>
    </table>

```

JavaScript

```
  $(document).ready(function ($) {
    $(".table-row").click(function () {
        window.open($(this).data("href"), $(this).data("target")); // Open new tab line
    });
});

```
In this case you need to use `windows.open` and you can use `_blank` 

```
<tr class="table-row" data-href="mypage.php">

$(document).ready(function ($) {
  $(".table-row").click(function () {
    var url = $(this).data("href");
    window.open(url,'_blank');
  });
});

```