简体   繁体   English

使jQuery移动日期框运行(TypeError:a.mobile.datebox未定义)

[英]get jQuery mobile datebox running (TypeError: a.mobile.datebox is undefined)

I cannot get the jQueryMobile - DateBox running. 我无法运行jQueryMobile-DateBox。 It is not shown at all and I get some JS errors. 它根本没有显示,我遇到了一些JS错误。 Here is my code: 这是我的代码:

Header: 标头:

<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<link rel="stylesheet" href="css/jquery.mobile.structure-1.2.0.min.css" />
<link rel="stylesheet" href="css/jqm-datebox-1.1.0.min.css" />
<script type="text/javascript" src="js/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript" src="js/jqm-datebox-1.1.0.mode.calbox.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile.datebox.i18n.de.utf8.js"></script>

Body: 身体:

<form id="formular" name="formular" method="post" action="enquiry.php">
  <table>
    <tr>
      <td>Arrival</td>
      <td><input name="arrival" id="frm_arrival" type="date" data-role="datebox" data-options='{"mode": "calbox"}' value="<?php echo $arrival; ?>" /></td>
    </tr>
    <!-- .... -->
  </table>
</form>

The datepicker is not shown and Firebug gives me the following errors: 没有显示日期选择器,Firebug给了我以下错误:

TypeError: a.mobile.datebox is undefined
TypeError: jQuery.mobile.datebox is undefined

The error should be on line 11 of jquery.mobile.datebox.i18n.de.utf8.js . 错误应该在jquery.mobile.datebox.i18n.de.utf8.js第11行上。 This is the line: 这是一行:

jQuery.extend(jQuery.mobile.datebox.prototype.options.lang, {

I cannot find the error. 我找不到错误。 Is it a jQuery conflict? 这是jQuery冲突吗? Am I using jQueryMobile - DateBox the wrong way? 我使用jQueryMobile - DateBox的方式错误吗? What I'm doing wrong? 我做错了什么?

Switch these two lines, I'm guessing the first one depends on the second one: 切换这两行,我想第一行取决于第二行:

<script type="text/javascript" src="js/jqm-datebox-1.1.0.mode.calbox.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile.datebox.i18n.de.utf8.js"></script>

To this: 对此:

<script type="text/javascript" src="js/jquery.mobile.datebox.i18n.de.utf8.js"></script>
<script type="text/javascript" src="js/jqm-datebox-1.1.0.mode.calbox.min.js"></script>

EDIT 编辑

You need to include the actual datebox file in your header. 您需要在标题中包含实际的日期框文件。 The German version is only a translation. 德文版仅是翻译。 It doesn't contain the datebox plugin itself. 它不包含日期框插件本身。

Arrange your script tags like so: 像这样排列脚本标签:

<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript" src="jquery.mobile.datebox-something-something.js"></script>
<script type="text/javascript" src="jqm-datebox-1.1.0.mode.calbox.min.js"></script>
<script type="text/javascript" src="jquery.mobile.datebox.i18n.de.utf8.js"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM