How to bind a jQuery class to a dynamically create INPUT element?

How to bind a jQuery class to a dynamically create INPUT element?

// define a jQuery getdate class for datepicker below
(function() {  

var d = new Date();
var maxD = new Date(d.setDate(d.getDate())); 
$('.getdate').datepicker({changeMonth: true,changeYear: true,yearRange: "-31:+0",maxDate:maxD}); // ,dateFormat: "MM dd, yy"

})();    


// goal: add a defined jQuery class to a dynamically created INPUT field
// defined jQuery class = getdate; and it works fine with regular reference

// create a dynamic INPUT element 
var cellText = document.createElement('input');
// cellText.type = 'date';
cellText.type = 'text';
cellText.id = 'DateDOT[]';
cellText.name = 'DOT[]';

// cellText.className = 'getdate';
// cellText.setAttribute('class','getdate');
neither of the above binding the 'getdate' class to this new input element
how come?

Thanks.