我想显示两种类型的 jquery 时间选择器

发布于 2024-12-21 03:25:56 字数 1441 浏览 2 评论 0原文

我想区分两个时间选择器。之前,两个时间选择器都显示在一个文本框中。现在,两个时间选择器都显示在右侧文本框中。但有一个问题,我想要一个文本框(持续时间文本框)显示 trent richardson jquery 时间选择器,而我想要另一个文本框(开始时间文本框)显示 francois gelinas 时间选择器。

目前,两个文本框都使用 trent richardson 时间选择器,但我不知道如何在函数中分离两个时间选择器,以便代码知道哪个时间选择器是 trent 的,另一个是 francois 的。

jquery 和 html 代码如下:

        $(function() {
            $('#timepicker').timepicker({ //francois timepicker
        showOn: 'button',
        button: '.timepicker_button_trigger'});


            $('#durationpicker').timepicker({ //trent's timepicker

                });

        });

     <form action="QandATable.php" method="post" id="sessionForm">


<p><strong>3: Duration:</strong> <input type="text" id="durationpicker" name="durationChosen" readonly="readonly" /></span>

<p><strong>5: Start Time:</strong> <input type="text" id="timepicker" name="timeChosen" readonly="readonly" /><span class="timepicker_button_trigger"><img src="Images/clock.gif" alt="Decrease" /></span>
                <br/><span id="dateTimeAlert"></span></p>
    </form>

要查看 trent 的时间选择器,请单击此处(他有一个日期和时间选择器,在页面下方他只有时间选择器)。

要查看 francois 的 timepicker,请点击此处(此 timepicker 更适合选择时间,但它不包含秒数,而特伦特的)

I want to diffrentciate 2 timepickers. Before, both timepickers were displayed in one textbox. Now both timepickers are displayed with the right textbox. But there is one problem, I want one text box (duration text box) to display the trent richardson jquery timepicker and I want the other text box (start time text box) to display the francois gelinas timepicker.

At the moment both textboxes uses the trent richardson timepicker but I do not know how to seperate both timepickers in my function so that the code knows which timeicker is trent's and the other is francois's.

The jquery and html code is below:

        $(function() {
            $('#timepicker').timepicker({ //francois timepicker
        showOn: 'button',
        button: '.timepicker_button_trigger'});


            $('#durationpicker').timepicker({ //trent's timepicker

                });

        });

     <form action="QandATable.php" method="post" id="sessionForm">


<p><strong>3: Duration:</strong> <input type="text" id="durationpicker" name="durationChosen" readonly="readonly" /></span>

<p><strong>5: Start Time:</strong> <input type="text" id="timepicker" name="timeChosen" readonly="readonly" /><span class="timepicker_button_trigger"><img src="Images/clock.gif" alt="Decrease" /></span>
                <br/><span id="dateTimeAlert"></span></p>
    </form>

to look at trent's timepicker, click here (he has one which is date and timepicker and further down the page he just has timepicker).

To look at francois's timepcker click here (this timepicker is better for picking time but it does not contain seconds while trent's does)

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

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

发布评论

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

评论(1

落日海湾 2024-12-28 03:25:56

假设他们都遵循良好的 jquery 插件指南,他们都会将相同的 $.fn.timepicker 对象设置为自己的方法。要使用这两个插件,我认为您必须将源代码中的其中一个更改为其他内容...

在插件中...

$.fn.trentTime = function(){ ... }

以及在您的代码中...

$('#durationpicker').trentTime({ ... });

assuming they both follow good jquery plugin guidelines, they will both be setting the same $.fn.timepicker object to their own method. To use both plugins, I think you will have to change one of them in the source code to something else...

in the plugin...

$.fn.trentTime = function(){ ... }

and in your code...

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