Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams <link rel="stylesheet" type="text/css" href="<%=contextPath %>/style_sheet/page_header.css" > <link href="<%=contextPath %>/scripts/jQuery/jquery-ui.css" rel="stylesheet" type="text/css"/> <script src="<%=contextPath %>/scripts/jQuery/jquery.min.js" ></script> <script src="<%=contextPath %>/scripts/jQuery/jquery-ui.min.js"></script> <script src="jscript.js" ></script> <style> .pageWidth width: 800px; </style> <script> $(document).ready(function(){ $("#startDatePicker").datepicker(); </script> <title>GFW Voice OUT Files Trend</title> </head> <table width="800x" border="0" align="center"> <td>Start Date: <input type="text" id="startDatePicker" /></td> </table> </body>

I get an error at the syntax

$(document).ready(function(){
   $("#startDatePicker").datepicker();

Error

The function $(HTMLDocument) is undefined.

I though eclipse is getting confused between EL and jQuery syntax, but using \$ did not help. what am I doing wrong? All I want to do is use jQuery datepicker.

jquery file is not installed correctly. Use that code its work.

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"      "http://www.w3.org/TR/html4/loose.dtd">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
  <script>
$(function() {
    $( "#datepicker" ).datepicker();
</script>
 <title>Test</title>
</head>
Date: <input type="text" id="datepicker" />
</body>
  </html>
<table width="800x" border="0" align="center">
           //----^-----------------remove the x here no need of it
jQuery(document).ready(function($){
   $("#startDatePicker").datepicker();
                Thanks. that x was a typo. Tried this -  jQuery(document).ready(function($){    $("#startDatePicker").datepicker(); });   But I get this error on the word jQuery  - The function jQuery(HTMLDocument) is undefined
– user195958
                Dec 4, 2012 at 18:25
                Sorry, that shouldn't be there. Since I thought the $ sign in a jsp is causing issues I tried including the script above in a separate file. But that didn't work either.
– user195958
                Dec 4, 2012 at 18:28
                your code is working fine: jsfiddle.net/cQqDu just make sure you are refering your jquery plugin file well.
– Jai
                Dec 4, 2012 at 18:31
                src="<%=contextPath %>/scripts/jQuery/jquery.min.js" your jsp page gets it when page loads.
– Jai
                Dec 4, 2012 at 18:36
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.