RollerCosta RollerCosta - 4 months ago 12x
jQuery Question

Jquery DatePicker to multiple elements.?

How to apply Jquery DatePicker to multiple elements. at once??

Suppose i have 3 TextBoxes

<td class="textBox">@Html.LabelFor(model => model.textbox1)
<td class="textBox">@Html.LabelFor(model => model.textbox2)
<td class="textBox">@Html.LabelFor(model => model.textbox3)

Now here i want to apply datepicker to all three textBoxex at once.

I also want to know is it possible to set mm-yy as datepicker format???


How to set regional datepicker dateFormat and dateRange at one step??


Changed @Html.LabelFor to

@Html.TextBoxFor(model=>model.textbox1,new{@class=textBox1}) @Html.TextBoxFor(model=>model.textbox1,new{@class=textBox1}) @Html.TextBoxFor(model=>model.textbox1,new{@class=textBox1})

Then used below script

<script type="text/javascript">

$(function () {
        changeMonth: true,
        changeYear: true,
        dateFormat: 'mm-yy',
        yearRange: '1900:2012'
    $(".textBox").datepicker("option", $.datepicker.regional[anyculture]);