Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi friends
i've a piece of code when i view it in browser it gives 'jQuery' is undefined error.

In this code i Want datepicker to be implemented however i'm not able to do so
I've reffered many sites and i'm finding similar kind of code written
please help me out to find out where i'm wrong
XML
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <script src="jscript/jquery.datePicker.js" type="text/javascript"></script>

    <script src="jscript/jquery-1.5.1.min.js" type="text/javascript"></script>

     <script type="text/javascript">
        $(function() {
           $('#startdate').datepicker({ dateFormat: 'dd/mm/yyyy' });
           $('#enddate').datepicker({ dateFormat: 'dd/mm/yyyy' });
          });
    </script>


<div id="content">        From <asp:TextBox ID="startdate" class="field" runat="server"></asp:TextBox> -
 To <asp:TextBox ID="enddate" class="field" runat="server"></asp:TextBox>    </div>
</asp:Content>


i'm using master page
in which i've included these two following references that are used here

XML
<link href="jscript/jquery.ui.all.css" rel="stylesheet" type="text/css" />
   <link href="jscript/datePicker.css" rel="stylesheet" type="text/css" />

i've checked the script with other functions is working for eg $('#startdate').value("some text") works very well
but datepicker method is not working
it is also giving error that this method is not supported by object

Thanks in advance....
Posted
Updated 22-May-12 23:13pm
v2

check this link http://www.dotnetcurry.com/ShowArticle.aspx?ID=669[^].

Add jquery in HEAD section.
 
Share this answer
 
Comments
preet88 23-May-12 7:13am    
thanks
You need to debug this.
First of all add the jquery file path in the header.
then
show the path (alert(jquery path)) of the jQuery you have added in the header and make sure that your jquery file exists at this path.
 
Share this answer
 
include all your reference in master page


XML
<script src="jscript/jquery.datePicker.js" type="text/javascript"></script>

    <script src="jscript/jquery-1.5.1.min.js" type="text/javascript"></script>
 
Share this answer
 
Add

XML
<script src="jscript/jquery.datePicker.js" type="text/javascript"></script>

    <script src="jscript/jquery-1.5.1.min.js" type="text/javascript"></script>


on same page where function is created.
 
Share this answer
 
Reverse the order. The JQuery library always comes first
 
Share this answer
 

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