Click here to Skip to main content
13,766,627 members
Rate this:
 
Please Sign up or sign in to 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
<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

<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 22-May-12 21:14pm
Updated 23-May-12 0:13am
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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

Add jquery in HEAD section.
  Permalink  
Comments
preet88 23-May-12 7:13am
   
thanks
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

include all your reference in master page


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

    <script src="jscript/jquery-1.5.1.min.js" type="text/javascript"></script>
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

Add

<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.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

Reverse the order. The JQuery library always comes first
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web06-2016 | 2.8.181114.1 | Last Updated 14 Feb 2014
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100