jquery datepicker多个实例 [英] jquery datepicker multiple instances

查看:115
本文介绍了jquery datepicker多个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经提出了一个RequestForQuote表单,其中我给出了可以添加新职位以获得RFQ的功能。

I have made a RequestForQuote form, in which I give the possebility to add new positions to get RFQ'ed.

在基础知识中,这很容易通过PHP在我的情况下工作真的很好你可能想看看。可以在以下网址找到:我的网站

In basics this is quite easy done via PHP in my case. Work realy fine. You may want to have a look. It is to be found at: my website

现在我感染了jquery病毒,只想添加datepicker ui(对于我们从他们的网页获得的最新版本)。

Now I got infected with the jquery-virus and simply wanted to add the datepicker ui (for the latest version I got from their webpage).

<input type="text" size="10" id="deldate[] 
     class="datepicker" value="<?php echo $_REQUEST['deldate'][$k]; ?>" />

$ k来自一个php $ k = 0; $ k <= $ NoPos; $ k ++)循环

$k is from a php for($k=0;$k<=$NoPos;$k++) loop

JavaScript代码工作如下:

the javascript code work is like:

$(function() {
$('input').filter('.datepicker').datepicker({
        showOn: 'button', 
        buttonImage: 'calender/media/cal.gif', 
        buttonImageOnly: true,
        firstDay: 1,
        dateFormat: 'yy-mm-dd', 
        minDate: 0, maxDate: '+4Y'});

}); 

在浏览器中看起来很不错,你会显示,我可以选择一个日期。

An in the browswer it looks quite nice, the ui shows up, I cann select a date.

但是...

如果我在表单中添加了另一个位置,这是通过PHP完成的,所以我必须提交表单来计数$ NoPos,以前的无效日期是丢失,我有一个空白的输入字段。

if I add another position to the form, which is done via PHP, so I have to submit the form to count $NoPos up, the formerly inersted date(s) is lost and I have a blank input-field.

现在有
onSubmit:function(dateText)我可以得到选定的日期,但是我在accessi中失败了输入正确的输入字段来放入日期。

now with the onSubmit: function(dateText) I can get the selected date. However I am failing in accessing the correct input field to put the date in.

所以我的问题很简单:我做错了什么?如果evrything是罚款,请有人请告诉我如何解决这个..

So my question is simple: What am I doing wrong? If evrything is fine then someone would please please tell me how I can solve this..

我有一些东西,如:

for (var i=0;i<=NoPos;i++) {
    var tag = "#deldate"+i;
    $(tag).datepicker({ ... });
}

并使用php到< input type = textsize =10id =lieferdat<?php echo $ k;?> class =datepicker/>

非常感谢您的耐心阅读本文...

Many thanks for your assumed patience to read through this...

,还有更多的谢谢给出的任何提示。

and many more thanks for any hints given

Cheers Daniel

Cheers Daniel

推荐答案

我正在寻找同样的自己,我想我发现这个技巧
$('input' ).filter('。datepickerclass')。datepicker()

和相关的输入元素:

class = datepickerclass

i was looking for the same myself, and i think i found the trick to it: $('input').filter('.datepickerclass').datepicker()
and on the relevant input elements:
class="datepickerclass"

我看到上面你尝试过类似的东西,但只是遵循食谱(该链接)为我工作。

i see above you tried something similar, but just following the recipe (of that link) worked for me.

这篇关于jquery datepicker多个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆