Overview
JavaScript and CSS techniques to make entire table rows navigate on click.
Originally published on Jang Keyte's Blog.
This article covers Make HTML Table Rows Clickable — practical notes from real-world web development experience.
Code Examples
<tr class="table-default clickable-row" data-href="/user/detail/1">
jQuery(document).ready(function($) {
$(".clickable-row").click(function() {
window.location = $(this).data("href");
});
});
Read More
For the full Vietnamese version, switch language using the VI | EN toggle above, or visit the original post.
Thêm thuộc tính clickable-row vào thẻ
<tr class="table-default clickable-row" data-href="/user/detail/1">
Viết script xử lý thao tác click vào row đó và chuyển tới href chỉ định
jQuery(document).ready(function($) {
$(".clickable-row").click(function() {
window.location = $(this).data("href");
});
});
Thanks for reading!