0

    <script src="<%=("../Scripts/jquery-1.6.1.min.js") %>" type="text/javascript" />
   <script src="<%=("../Scripts/jquery-datePicker.js") %>" type="text/javascript" />

<script type="text/javascript">

    $(function() {

     $("#txtDate").datepicker();       

    });   

   </script>

I have used this code but it doesnot show me the popup calender on click on textbox. what can be the problem. it doesnot give any error.

0

3 Answers 3

1

Perhaps you should use the document.ready function

$(document).ready(function() {
 $("#txtDate").datepicker();       
});
Sign up to request clarification or add additional context in comments.

Comments

0

why not set path directly? and close script tag with this </script>

<script src="../Scripts/jquery-1.6.1.min.js" type="text/javascript" ></script>
<script src="../Scripts/jquery-datePicker.js" type="text/javascript" ></script>

Use ClientID for server control

<script type="text/javascript">

    $(function() {

     $("#<%= txtDate.ClientID %>").datepicker();       

    });   

   </script>

you can also use ready function

<script type="text/javascript">
$(document).ready(function() {
 $("#<%= txtDate.ClientID %>").datepicker();       
});
</script>

if ID selector doesn't work then use class selector it is good for ASP.NET server control

<asp:TextBox ruat="server" ID="txtDate" CssClass="DateField"></asp:TextBox>

<script type="text/javascript">
    $(document).ready(function() {
     $(".DateField").datepicker();       
    });
    </script>

Comments

0

ID of ASP.NET server control is different than that of the normal HTML ID. So if you are using a Server control, then run your code, open the page source, get the ID that is displayed in the page source and use this ID instead of txtDate.

Also use

$(document).ready(function() { $("#<id>").datepicker(); });

1 Comment

It couldnot be run.it just shows error of object expected.I m afraid if i have attached enough src or not

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.