1

嗨,我是新来的朋友intel XDK

我的代码:-

<html>
<head>

    <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css">
    <script src="//code.jquery.com/jquery-1.9.1.js"></script>
    <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
    <script src="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js"></script>

<script>

   $(function() {
      $( "#txt_date" ).datepicker({
      changeMonth: true,
      changeYear: true
     });
    });
</script>
</head>
<body>

    <input type="text" name="text-date" id="txt_date" value="" readonly="true" >

</body>
</html>

我也试过只读输入文本的属性,但我无法解决我的问题。

问题 :

在这里我的问题是,当我点击输入文本时,我会很好Jquery Datepicker。但是Datepicker我也可以Keyboard在我的移动设备上使用。所以如果有人有这个问题的解决方案,请帮助我。

提前致谢!!

4

1 回答 1

0

我认为你应该这样:

$(function() {
         $("#txt_date").keypress(function(event) {
                event.preventDefault();
         });

    $( "#txt_date" ).datepicker({
      changeMonth: true,
      changeYear: true
    });
  });
于 2014-01-30T08:57:28.483 回答