How to attach calendar by class name

Dear helpers,

what would be the easiest way to attach a calendar to all inputs of a certain class? I use jquery to get all elements of the class and then a loop, but it think there is a better way.

Thank you very much for you help. With best regards,
Phantom

My current solution:

$(document).ready(function()
{
myCalendar = new dhtmlXCalendarObject();
  $('.cal').each(function()
    {
     myCalendar.attachObj(this.id);
    });
}