I am using jQuery to dynamically build the column header for fullcalendar.js. This code is working but I want to be able to add a class name to each of the elements.
function buildDateColumnHeader(theDate) {
var container = document.createElement('div');
var DDD = document.createElement('span');
var ddMMM = document.createElement('span');
DD.textContent = theDate.format('DD').toUpperCase();
ddd.textContent = theDate.format('ddd');
container.appendChild(DD);
container.appendChild(ddd);
return container;
}
I have tried the following and they produce errors:
DDD.classname = "ds-header-day";
var DDD = document.createElement('span').addClass('ds-header-day');
This is probably easy for a jquery savvy person.
DDD.addClass('ds-header-day');?they produce errorsAnd they are?