Yes it is possible with javascript.
Inserting links between table and tr is not correct syntax, so the path is actually javascript.
You can add an "Event Handler" that looks for clicks within the rows of the table. When a click happens it fetches the link from that line and opens it.
Example with jQuery:
var linhaTabela = $('table tr');
linhaTabela.on('click', function (event) {
var link = $(this).find('a').attr('href')
link && window.location = link;
});
If there is no link inside the line as I mentioned in the example above, you can assign via your php the link information in a field data-
, yes in the table row.
So my example is
html
<tr data-href="http://www.google.com">
javascript
var linhaTabela = $('table tr');
linhaTabela.on('click', function (event) {
var link = $(this).data('href');
link && window.location = link;
});
+1 for "(including style)"
– Zignd
Verdade @Zignd! Full answer came. Valeu @Talles
– Luitame
To avoid unexpected behavior it is recommended to include the
[data-href]
on the selector:$('tr[data-href]').click(...)
.– Paulo Freitas