【问题标题】:jquery calendar datepicker does not work with my include phpjquery 日历日期选择器不适用于我的包含 php
【发布时间】:2012-09-18 09:38:37
【问题描述】:

我在使用输入类型日期时遇到了一些麻烦,出于兼容性原因,我决定使用类 datepicker 按文本类型更改所有输入类型日期。

当我使用 index.php 时,一切正常。

当我在其他页面上时,例如 index.php?p=home。即使它显示与 index.php 相同的页面,也不会出现日历。

这是我用于更改输入的代码。

<body onmousemove="resetTimer()" onload="startTimer();startTime();<?php if(isset($_GET['p']) AND $_GET['p']=='monitoring'){echo 'ajax();' ;}; ?>changefield()"> 
<!-- Script DATE  -->
<script>
    $(function() {
        $("input[type=date]").replaceWith("<input type='text' class='datepicker'/>");
        $( ".datepicker" ).datepicker({
            changeMonth: true,
            changeYear: true,
            showWeek: true,
            beforeShowDay: '',
            showAnim: "show"
        });
    });
</script>  

我真的不知道如何找到这个问题的问题。

接受我最大的尊重。

亲切的问候。

SP。

【问题讨论】:

  • 检查是否在其他页面上正确包含了 jQuery 和 datepicker 脚本。您可以在 Firebug 的 Net 选项卡中看到这一点。
  • 我实际上使用了另一个 jquery 我真的需要他们两个如果我发布这个所有工作,但如果我没有它,我的页面将无法正常工作

标签: php jquery html include datepicker


【解决方案1】:

您的代码应该可以工作...

jsfiddle

也许你没有包含 jquery-ui 脚本?

【讨论】:

  • 事实上当我使用那个 $("input[type=date]").each(function () { var $this = $(this); $this.replaceWith($('').attr({ name: $this.attr("name"), id: $this.attr("id"), value: $this.attr( “价值”) })); });为了保留有关输入的所有信息,它不起作用
【解决方案2】:

您的初学者有一个错字:

A`ND $_GET['p']=='monitoring'

【讨论】:

  • 这个“答案”应该作为评论发布。也适合初学者。 :)
  • 为什么要作为评论添加?
  • 这是真正的代码。当我尝试将其作为代码发布时,此站点会更改它我认为我在编辑文本时做错了
  • 哦,很抱歉我没有看到。非常感谢。
猜你喜欢
  • 2013-03-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多