Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Highlight a table row when radio button is selected...HELP!!

how i could highlight a table row when a user click a radio button which is located in that row

1 Answer

Bhaskar,

You could do this with the help of some JavaScript. You'll want to set up variables for each element in your DOM that you want to access (such as with .getElementsByClassName() and .getElementById()), and you'll want to set up event handlers to listen for when your radio buttons are clicked. You could tell those event handlers to call a function that checks to see which radio button is checked, and then alters the appropriate table row as necessary.

Erik