$("#StartDate, #FinishDate", "form#Create").each(function() { $(this).mask("9999-99-99 99:99:99"); });
but to note, ID's should be unique in the page, so having <html> <body> <form id="Form1"> <input type="text" id="StartDate" /> <input type="text" id="EndDate" /> </form> <form id="Create"> <input type="text" id="StartDate" /> <input type="text" id="EndDate" /> </form> </body> </html> doesn't semantically make sense (and isn't 'valid HTML' to boot) Why not just use a css class to denote which you want to "mask"?