开发者

jQuery datepicker doesn't work

I can't get the jQuery datepicker to work. I have followed everything from the jQuery UI manual. Can you please check my code below?

<!DOCTYPE htm开发者_JAVA百科l PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link type="text/css" href="js/jquery_theme/jquery-ui.css" rel="stylesheet" />
<script src="js/jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="js/ui.core.js"></script>
<script type="text/javascript" src="js/ui.datepicker.js"></script>

<script language="javascript">
$(function() {

 $("#test_input").datepicker();

});
</script>

</head>

<body>
<input type="text" name="test_input" id="test_input" />
</body>
</html>

Thank you for your time :)


Correct your <script> tag. You can then handle the returned date like this:

<script type="text/javascript">
  $(document).ready(
      function() {
          $('#input_test').datepicker(
              {
                  onClose: function(dateText, inst) {
                          alert("My date is: " + dateText);
                      }
              }
          );
      }
  );
</script>


Try placing your tag at the bottom of the page (after the body tag), or do this

 $(document).ready( function() {

   $("#test_input").datepicker();

 });

The javascript gets interpreted before the input(#test_input) tag is loaded into the dom, so that might be the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜