如何防止在intel XDK中输入文本上打开键盘?

时间:2014-01-30 08:56:42

标签: javascript jquery-mobile intel-xdk

嗨朋友我是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。如果有人有解决方案的话这个问题所以请帮助我。

先谢谢!!

1 个答案:

答案 0 :(得分:0)

我认为你应该这样:

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

    $( "#txt_date" ).datepicker({
      changeMonth: true,
      changeYear: true
    });
  });