I have some html tables on the page, and some checkboxes whose values to be highlighted on the assigned table. The example code can be seen here : https://jsfiddle.net/1oadc3fb/
What I need to do is only the assigned table values to be highlighted by that specific checkbox group. So when first checkbox group is clicked, values on table1 will be highlighted. and it goes on like that. The HTML tables have the same values, only their table id is unique and different.
This is just an example fiddle, there will be more checkbox groups and tables. I seek a way to do this automatically, without any manual change every time. since the checkbox values will be updated regularly. Can I get any help on this? please.
thanks, m_hutley. Tables have a unique table id. but checkboxes dont have it in the current structure. if it is necessary, I can change checkbox structure a little. would that be helpful?
PaulOB, I tried your code. and it does the job. thanks a lot. if there is an easier alternative, I am also open for this.
I have an additional question if you donât mind. When I insert checked="checked" to <input type='checkbox' name='SelectAll' class='all' />, so that itâd be checked & highlighted by default, it didnât work even though it was checked by default.
How can I make it work by default? it doesnât have to be checked by default, if there is a way to select âselectallâ checkbox, itâd be fine too. thanks.
You would need to run a check to see if the element has been checked and then run the code accordingly.
Iâve added it to this new fork.
However, we are now doing the same thing many times so this really needs breaking down and optimising so hopefully one of the js experts here can tidy it up for me