Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

i have a html table with a column date.in that i have textbox having class DATEPICKER i want to get the date picker in this column

when i used like
JavaScript
$(document).ready(function () {
    $('.datepicker').datepicker();
});

i am getting date picker in each row in the table. but when i select date in any datepicker, only first rows datepicker only changes.

can anybody help me

Thnaks
kunjammu


[Edit member="Tadit"]
Added pre tags.
[/Edit]
Posted
v3
Comments
Can you create a fiddle at http://jsfiddle.net/[^]?

Else post the whole code by Improving your Question.
Kabi Pr. Sahoo 11-Apr-14 6:05am    
Can you Please briefly describe about http://jsfiddle.net/[^]?
Kabi Pr. Sahoo 14-Apr-14 0:22am    
Thanks tadit..for the info.
Welcome bro. :)

I think this solution might helps you....
HTML
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

    <script>
    $(function() {
    $( "#datepicker" ).datepicker();
    });
    </script>
</head>
<body>
    <p>Date: <input type="text" id="datepicker"></input></p>
</body>
</html>



[Edit member="Tadit"]
Added pre tags.
[/Edit]
 
Share this answer
 
v2
Comments
Kunjammu 11-Apr-14 2:50am    
my date picker is inside a html table like
<th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.TextBoxFor(model => item.Date, new { @id = "date", @class = "datepicker", Value = item.Date.ToString("MM-dd-yyyy"), })
</td>
</tr>
}
</table>
i used


$(document).ready(function () {
       $('.datepicker').each(function () {
           $(this).removeClass('hasDatepicker').datepicker();
       });
   });
 
Share this answer
 
Comments
Snesh Prajapati 11-Apr-14 6:19am    
Finally you did it. Sorry due to some work I could not reply. Good Job.
Kunjammu 11-Apr-14 6:35am    
can u plzz help for
http://www.codeproject.com/Questions/758047/dropdwonlist-not-showing-selected-value

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900