Linked Questions

Popular Questions

How to open new tab using data-href

Asked by At

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>

Related Questions