I'm looking to dynamically add an active class to the current day in my web application.
An example of how it currently works is shown below:
$( document ).ready(function() {
$('a[href*="2208"]').addClass('active');
});
My goal is to automate the date in the code above (currently set as 2208) using moment.js.
Based on my understanding, moment.js can generate the required numbers with this script:
moment().format("DDMM");
So here's the question.
Is there a way to combine these scripts effectively?
Below is a simple attempt (I'm not very proficient in JS):
$( document ).ready(function() {
$('a[href*="' + moment().format("DDMM") + '"]').addClass('active');
});