I have a list of database records that display in a table format. I don't want them to have to click the individual link. I'd like the entire table row to be a link. How can I do this?
Clickable TR
Moderator: General Moderators
- SheDesigns
- Forum Commoner
- Posts: 42
- Joined: Tue Nov 18, 2008 9:51 am
- Location: Buffalo, NY
Clickable TR
I have a list of database records that display in a table format. I don't want them to have to click the individual link. I'd like the entire table row to be a link. How can I do this?
Re: Clickable TR
You can't make it a link per se, but you should be able to attach a click listener to it. There may be some issues with bubbling - ie: if the user clicks on a cell in that row, does the click event continue to travel up the DOM. If you're using a library (jQuery, Prototype, MooTools), I'd imagine the library would take care of that stuff.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: Clickable TR
I've never had problems with things travelling up the DOM. Do you mean using something like this?pickle wrote:You can't make it a link per se, but you should be able to attach a click listener to it. There may be some issues with bubbling - ie: if the user clicks on a cell in that row, does the click event continue to travel up the DOM. If you're using a library (jQuery, Prototype, MooTools), I'd imagine the library would take care of that stuff.
Code: Select all
<tr onclick="window.location('whatever.php');"><td>blah</td></tr>Re: Clickable TR
Ya - that's what I was referring to.
Didn't want to just give her the code though
Didn't want to just give her the code though
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.