jQuery   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jquery mobile datepicker无法正常工作o单击文本框大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
嗨,我是jQuerymobile的新手.我正在尝试实现一个日期选择器,需要弹出一个单击文本框的弹出窗口.但onSELEct不工作,没有点击动作正在发生.
代码

<head>
<Meta charset="utf-8">

<!-- Need to get a proper redirect hooked up. Blech. -->



<Meta name="viewport" content="width=device-width,initial-scale=1">
<title>RideMix</title>
<link rel="stylesheet"  href="jquery.mobile-1.3.2.min.css">
<link rel="shortcut icon" href="demos/_assets/favicon.ico">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,700">


<link rel="stylesheet" href="jquery.ui.datepicker.mobile.css" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothnes/jquery-ui.css" />   
<script src="jquery.js"></script>

<link rel="stylesheet" href="style.css">

<script>
    $( document ).on( "pageshow",function(){
        $( "p.message" ).hide().delay( 1500 ).show( "fast" );
    });
</script>
 <script>
$(function() {
$( "#datepicker" ).datepicker();
$( "#datepicker1" ).datepicker();

}); 
</script>
<div class="productimage">  

                <input data-theme="c" type="search" name="search" id="search-basic" value="" placeholder="Leaving from"/>
                <input data-theme="c" type="search" name="search" id="search-basic" value="" placeholder="Going to"/>
                <p>&nbsp</p>
                <div class="ui-bar ui-bar-b datetiR_797_11845@e">
                <h3 class="">Date and time </h3>
                </div>
                <div style="width:90%;">
                <br />
                <label>From Date</label>
                <input type="date" name="date" id="datepicker" value=""  />
                <label>To Date</label>
                <input type="date" name="date" id="datepicker" value=""  />

                </div>  
                    <p>&nbsp</p>
                <a href="#" data-transition="fade" data-role="button" data-theme="b"  style="width:70%;margin:auto">Next Step</a>
        </div>

提前致谢.

解决方法

尝试:

>更改输入类型=“文本”
>初始化datepicker时指定日期格式
>为输入字段分配唯一ID

这是一个例子:

$(function() {
  $("#datepicker-from").datepicker({
    dateFormat: 'yy-MM-dd'
  });
  $("#datepicker-to").datepicker({
    dateFormat: 'yy-MM-dd'
  });
});
<head>
  <Meta charset="utf-8">
  <Meta name="viewport" content="width=device-width,initial-scale=1">
  <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.css">
  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,700">
  <link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
  <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
</head>
<div class="productimage">
  <div class="ui-bar ui-bar-b datetiR_797_11845@e">
    <h3 class="">Date and time </h3>
  </div>
  <div style="width:90%;">
    <br />
    <label>From Date</label>
    <input type="text" name="date-from" id="datepicker-from" value="" />
    <label>To Date</label>
    <input type="text" name="date-to" id="datepicker-to" value="" />
  </div>
</div>

大佬总结

以上是大佬教程为你收集整理的jquery mobile datepicker无法正常工作o单击文本框全部内容,希望文章能够帮你解决jquery mobile datepicker无法正常工作o单击文本框所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。