Make your table rows clickable (with a link) - Web Design Tutorial

preview_player
Показать описание
As you cannot make an entire table row (tr) clickable (or linkable) using plain HTML, we need to resort to JavaScript in order to achieve this effect.

In this video we'll be looking at a technique to get around this using JavaScript, event listeners, delegated event listeners and some optional jQuery.

Support me on Patreon:

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!

#dcode #javascript #css
Рекомендации по теме
Комментарии
Автор

Check out my video on event delegation here:

dcode-software
Автор

your way of teaching is so amazing... steps to guide wonderful

HaiderYTpro
Автор

I was excited to watch this one because you mention "with a link" iv generated a lot of tables in my time and wondered how you got the tr to act as an anchor.
The reason this would be amazing is because you would capture all the accessibility functions of anchors and be able to middle mouse the link for a new tab and being able to drag the link ect.
But here we just have a tr with an onclick callback to a link.

Still good stuff and good tutorial! im just still searching for a way to get those tr's to actually just be anchors or <a> elements for all the inbuilt functionality of browsers.

XnecromungerX
Автор

I am not very familiar with HTML, Did what you just explained in the very begining :D

Very Helpful ... Thank you for the video :)

arunkutz
Автор

Very well explained. Thank you very much.

MichaelKuenzle
Автор

Bro!!! you sound like Korg from Thor hahah epic! are you trying to start a revolution? hahaha

jmctx
Автор

I have found this code and immedialtely used it for my puprposes. Thanks a lot :)

TomasMisura
Автор

hello sir please can you help me to find how to make table layout clickable(when i click in table layout the tablerow will be selected ) in android . i work in android studio thanks

sabrinafeliz
Автор

is there no other way of doing this w/o js?

DullFiction
Автор

very bad for google-bot, try to use css (display: table|table-row|table-column) instead

bernhardschonberger
Автор

This was a great video, thank you for making it! What if you want to have a different anchor tag link in one of your cells, how do you keep the row click from going first?

PopeJareth
Автор

how to do it using VUE JS sir? when i console the rows, nothing show :(

lapis
Автор

When the webpage reloads, it loses everything/data you added through console.. is there any way to stop losing it?

sunidhimistry
Автор

rows.forEach is not a function is printed in console

muhammadtaymoor
Автор

Hi Dom. Do you have any tutorial on the Strava API. I'm struggling to create their webhook. Can you help?

mg_slang
Автор

can you do this only with php and html ???

tavanogrim
Автор

how is your vs code that fine and clean

danieloniha
Автор

how to make the click event to open new page instead of replacing the current page?

manivelarung
Автор

Curious if this would have an impact on screen readers? Has any one looked into this? Screen readers rely on html being semantic so it is able to translate the content to the user. Doesn't adding the anchor in that way frankenstein what's understood to be a table?

monstermunch
Автор

i'm getting error:
$ is not defined

mihirmakwana