Page 1 of 1

Clickable TR

Posted: Wed Feb 25, 2009 2:28 pm
by SheDesigns
:oops:

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

Posted: Wed Feb 25, 2009 4:37 pm
by pickle
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.

Re: Clickable TR

Posted: Wed Feb 25, 2009 5:13 pm
by jayshields
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.
I've never had problems with things travelling up the DOM. Do you mean using something like this?

Code: Select all

<tr onclick="window.location('whatever.php');"><td>blah</td></tr>

Re: Clickable TR

Posted: Mon Mar 02, 2009 9:57 am
by pickle
Ya - that's what I was referring to.

Didn't want to just give her the code though ;)