jQuery 日期选择器在内容页面中不起作用

发布于 2025-01-05 23:09:56 字数 857 浏览 4 评论 0原文

我正在使用 jQuery 日期选择器。它在普通的 aspx 页面上运行良好。但它不适用于内容页面。

这是我的内容页面中的代码,

<asp:Content ID="body"  ContentPlaceHolderID="ContentPlaceHolder1" runat="server" >
   <div  id="content">
    <div id="examples">
    <div>
        Default time picker :
        <input type="text" style="width: 70px;" id="timepicker.[1]" value="" />

        <script type="text/javascript">
            $(document).ready(function () {
                $('#timepicker\\.\\[1\\]').timepicker();
            });
        </script>
     </div>
     </div>
    </div>

    </asp:Content>

我对 jQuery 不太熟悉,但我认为这些行会导致问题,因为它们检查 body 标签。我尝试在那里放置 div id 但无法让它工作。

find("body").append($.timepicker.tpDiv);
$("body").append(this.tpDiv);

如何在没有 body 标签的情况下附加 div

I am using a jQuery date picker. It works fine on a normal aspx page. But it doesn't work on the content pages.

This is the code in my content page

<asp:Content ID="body"  ContentPlaceHolderID="ContentPlaceHolder1" runat="server" >
   <div  id="content">
    <div id="examples">
    <div>
        Default time picker :
        <input type="text" style="width: 70px;" id="timepicker.[1]" value="" />

        <script type="text/javascript">
            $(document).ready(function () {
                $('#timepicker\\.\\[1\\]').timepicker();
            });
        </script>
     </div>
     </div>
    </div>

    </asp:Content>

I am not very familiar with jQuery but I suppose these lines cause problem since they check for the body tag. I tried using placing div id there but can't get it to work.

find("body").append($.timepicker.tpDiv);
$("body").append(this.tpDiv);

How can I append the div without body tag

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

她如夕阳 2025-01-12 23:09:56

使用类选择器。

<input type="text" style="width: 70px;" id="timepicker.[1]" value="" class="timepicker" />

 <script type="text/javascript">
                $(document).ready(function () {
                    $('.timepicker').timepicker();
                });
            </script>

use class selector.

<input type="text" style="width: 70px;" id="timepicker.[1]" value="" class="timepicker" />

 <script type="text/javascript">
                $(document).ready(function () {
                    $('.timepicker').timepicker();
                });
            </script>
荒岛晴空 2025-01-12 23:09:56

也许你可以使用其他容器?喜欢

$("#anyDIV").append()

May be u can use some other container ?? like

$("#anyDIV").append()
灼痛 2025-01-12 23:09:56

1.运行您的页面。
2.右键-->检查元素 -->复制 ID。
3.现在将该 ID 粘贴到您的代码中并运行。

1.run your page.
2.right click --> inspectelement --> copy id.
3.now paste that id in your code and run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文