How to make a table row a link with JavaScript?

Spread the love

Sometimes, we want to make a table row a link with JavaScript.

In this article, we’ll look at how to make a table row a link with JavaScript.

How to make a table row a link with JavaScript?

To make a table row a link with JavaScript, we make the table row go to the destination URL on click.

For instance, we write

<tr onclick="document.location = 'links.html';"></tr>

to make the tr go to the links.html page on click by setting the tr’s onclick attribute to document.location = 'links.html.

Conclusion

To make a table row a link with JavaScript, we make the table row go to the destination URL on click.

Leave a Reply

Your email address will not be published. Required fields are marked *