How to make 2 scripts 1 script

https://codepen.io/lasjorg/pen/PoQqOQa is the solution!!! Thank you so very very very much!!!

1 Like

Happy to help. I would like to make sure you understand why that code works.

  1. The date value is generated and set as the content for the span element.

  2. The jQuery selector looks for the span (each is a loop) and saves its content as cellValue, i.e. the date value.

  3. To get the parent th element of the span we use the parent() jQuery function.

  4. Instead of coloring $(this) which is the span, we color $(this).parent() which is the th parent element.


Let me know if you are done with my Codepen, you can fork it (fork button at the footer) and I will delete it.

2 Likes

Very much appreciated, @ lasjorg. I’ve forked the codepen and exported it as a zip so I have a local backup too. Thanks!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.