Home › Forums › JavaScript › Highlight Table Row Class on Separate Click
- This topic is empty.
-
AuthorPosts
-
March 16, 2019 at 7:57 pm #284946webryanParticipant
I’m creating an availability calendar for a mock resort. The idea is that the resort has cabins numbered 0 – 7 and each cabin can be reserved from Saturday afternoon one week and checkout Saturday morning the following week. I want the default setting to be unavailable with the table row background being a light shade of red. I’m trying to figure out how to set up the code to have a clicked/active “Cabin 1” button show all of the table rows in which Cabin 1 was available. Then the same with the other Cabins.
So I figured that I’d have a css class “unavailable” [bg-color: red] as the first class then add “c0 c1 c2 c3, etc” [bg-color: green] as classes to override to the unavailable class with the green background.
In the example below I have the table row ID=”may18-may25″ which should highlight green when Cabin1 (c1) Cabin2 (c2) or Cabin3 (c3) are clicked, but when every other button is clicked it shows the class=”unavailable” red background.
I am clueless with javascript and can understand a little bit when reading it, but can’t write a lick. If there is a pure css way to do this, I’d much rather do that, but this seems to be a method for only javascript.
Week Saturday Sunday Monday Tuesday Wednesday Thursday Friday Saturday May 18th – May 25th May
18May
19May
20May
21May
22May
23May
24May
25May 25th – June 1st May
25May
26May
27May
28May
29May
30May
31June
1March 17, 2019 at 2:15 am #284949BeverleyhParticipantCan you mock us up a working demo in CodePen so that we are more easily able to see how you’re working? It’s hard to decipher a description.
March 17, 2019 at 2:16 am #284950Paulie_DMemberClicks require javascript., especially if you want the effect to persist from one session to another.
March 17, 2019 at 5:00 pm #284975 -
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.