将不同的CSS应用于不同的jQuery日期选择器 [英] Apply different CSS to different jQuery datepickers

查看:66
本文介绍了将不同的CSS应用于不同的jQuery日期选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个与输入字段绑定的日期选择器。它们是以通常的方式创建的:

I have several datepickers tied to input fields. They are created in the usual way:

$('#input1').datepicker(options1);
$('#input2').datepicker(options2);

现在我想为每个字段设置不同的样式。但是当在Firefox中检查页面时,我发现每个日期选择器都是 div ,具有相同的 id UI的日期选择器-DIV !并且它们不是输入字段的后代或兄弟,所以我没有看到在CSS选择器中使用输入' id 的方法。

Now I want to style them differently for each field. But when inspecting the page in Firefox, I see that each datepicker is a div with the same id: ui-datepicker-div! And they aren't descendants or siblings of input fields, so I don't see a way to use the inputs' ids in CSS selectors.

推荐答案

我认为你必须使用 beforeShow 或其他一些动态修改datepicker的回调或事件。您没有发布有关您使用的 options1 options2 的更多详细信息。可能你必须解决更多其他问题。

I think that you'll have to use beforeShow or some other callback or event to modify the datepicker dynamically. You don't posted more details about options1 and options2 which you use. Probably you will have to solve more additional problems.

这篇关于将不同的CSS应用于不同的jQuery日期选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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