1

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.

7
  • src="../_Scripts. Is that the correct location when you are running your application? Commented Mar 11, 2014 at 0:05
  • yes thats what I get when I dragged and dropped on to page. I tried it with only _Scripts/jquery-1.8.2.js but didn't work Commented Mar 11, 2014 at 0:06
  • Did you check the console in the browser's dev tools for errors? Commented Mar 11, 2014 at 0:08
  • <script src="<%=ResolveUrl("~/_Scripts/jquery-1.8.2.js") %>" type="text/javascript"></script> Try that and do that to the other one. Commented Mar 11, 2014 at 0:08
  • @RickS I get "0x800a1391 - JavaScript runtime error: '$' is undefined" Commented Mar 11, 2014 at 0:09

1 Answer 1

1

<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?

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

Comments

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.