How to make 2 scripts 1 script

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