Question

I'm experiencing a strange issue. I'm using JQuery date-picker in my user control. When I try with google hosted libraries, things work nicely.

ie:

 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"  type="text/javascript"></script>

 <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js" type="text/javascript"></script>

Next I downloaded the two libraries added them to my project(asp.net web site). When I reference them and try to run, it doesn't recognize jquery syntax (stops at jquery code and saying $ is not recognized). But intellisense is working.

this is my code:

<script src="../_Scripts/jquery-1.8.2.js" type ="text/javascript"></script>
<script src="../_Scripts/jquery-ui.min.js" type ="text/javascript"></script>

<script type ="text/javascript">

 $(function () {
     $("#<%=TextBox1.ClientID%>").datepicker({ dateFormat: 'dd/mm/yyyy' });
  });
 </script>


 <asp:TextBox runat ="server" ID ="TextBox1" Width ="80px"  ></asp:TextBox>

where is it going wrong? Some insight is really appreciated.

Was it helpful?

Solution

<script src="<%=ResolveUrl("~/_Scripts/jquery-1.8.2.js") %>" type="text/javascript"></script>

Try that and do that to the other one.

Reference: How to Properly Reference a JavaScript File in an ASP.NET Project?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top