Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


jquery datepicker -- on multiple fields

Posted on 2013-06-25
Medium Priority
Last Modified: 2013-07-11
How can I do something like
 $("#CreateDate" || "AuthorizedDate").datepicker({....
so can merge the below two
<script type="text/javascript">
sections into one ?
 <div class="editor-label">
            @Html.LabelFor(model => model.AuthorizedBy)
        <div class="editor-field">
            @Html.EditorFor(model => model.AuthorizedBy)
            @Html.ValidationMessageFor(model => model.AuthorizedBy)

@section Scripts {

       <script type="text/javascript">
           $(document).ready(function () {
                   changeMonth: true,
                   changeYear: true

           <script type="text/javascript">
               $(document).ready(function () {
                       changeMonth: true,
                       changeYear: true
Question by:finance_teacher
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 58

Assisted Solution

Gary earned 1000 total points
ID: 39276284
Normal format for jquery is


have never tried it with the datepicker tho, so may not work

Accepted Solution

ScorchD earned 1000 total points
ID: 39276435
Just use a class, then you can have as many as you need and automated.
$( ".datepicker" ).datepicker({ 

Open in new window


Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question