I have a table that is dynamically generated. Each entry is pulled from a database. Each row contains a title, model number, and image - as its own <td>
.
The titles are all stored like this in the database:
<a href="site.com/item_01.php">Item 01</a>
so the displayed name can also be a link.
The problem is - only the title is clickable, I can't seem to move the <a>
tag outside of the relative column. I want the entire row to be clickable now.
Question: Is there a way using javascript to get the URL of a <td>
and apply at to a <tr>
that proceeds it? This would have to be all be dynamic, and each row would be different.
(I'm assuming of course to use javascript/jquery to assign the URL to each class.)
Something like this:
<tr class="the_url_that_comes later">
<td class="grab_this_class's_URL">
<a href="the_url_i need_to_get">Item_01</a>
</td>
</tr>
Or could I somehow stretch the across the other columns, maybe with absolute positioning/z-index/display:block??
Thanks for the help, I've never encountered anything like this before!