0

I am trying to implement the jQuery datetimepicker in my ASP.NET webpage.

  1. Followed the link http://www.projectcodegen.com/JQueryDateTimePicker.aspx

  2. I am trying to implement the sample in my code.

  3. I did add the js and the css files to my application.

The pop-up calender with time is not displayed when I run the application.

<link rel="Stylesheet" href="jquery.ui.datetimepicker.css" type="text/css" />   
<script src="Scripts/jquery.ui.datetimepicker.js" type="text/javascript"></script>
<script src="Scripts/jquery.ui.datetimepicker.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function(){           
        $('TextBox1').datetimepicker();
        });
</script>
<body>
    <form id="form1" runat="server">
    <div>        
       <input type="text" id="TextBox1" />        
    </div>

2 Answers 2

5

In jQuery, to select elements by id you do it like this:

$('#TextBox1').datetimepicker();

See the documentation on ID selectors and class selectors

Sign up to request clarification or add additional context in comments.

Comments

1

jQuery ui comes with an extremely easy to use datepicker. There are excellent easy to follow examples for every control.

Here's the link to the demo/documentation of the DatePicker:

http://jqueryui.com/demos/datepicker/

To use jQuery ui you need to following references. I don't see these in your code.

<link type="text/css" href="css/themename/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />  
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>

2 Comments

The scripts listed in the OP code sample could be the jquery ui css/js files but the naming is not consistent with the defaults of those files. So I assume they are not the same.
Thank for your time .i am looking for the datetimepicker not just the date picker.Its working fine with the syntax $('#TextBox1').datetimepicker();,which fixes my problem in the code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.