Getting value of selected row in second table after another row is selected in first

224
May 24, 2017, at 10:00 AM

Let's say I have a set of two tables that are generated by Javascript. The table values are pulled from an online database. As part of the table creation, an event listener is added to each row in each table.

When a row is selected, the event listener automatically adds an ID and class called selected to the target row.

In another function, I pull the content of the selected row from the first table and store it in a variable. However, since the selected class and ID are the same in both tables, I can't use it to grab the value of a selected row from the second table; instead, I add the first row's content.

What's the best way to get the selected value of the second row?

Answer 1

add unique ID to your select input

READ ALSO
Whats wrong with these lines of Javascript/Jquery? [on hold]

Whats wrong with these lines of Javascript/Jquery? [on hold]

I am running these lines but somehow it breaks my jsWhen I run them like this it's fine

149
Creating new object from existing object

Creating new object from existing object

I've been at this for a while and can't figure out what I have and how to work with it

174
Consuming Spring REST API with jQuery

Consuming Spring REST API with jQuery

I wrote simple Spring REST webappNow I want to consume my API with some client

250
React router how to render a new component inside an existing one

React router how to render a new component inside an existing one

This is tough to explain, but say I have a nav bar up top that contains all the main linksI click the models link from the navbar up top and it renders the models page down below

361