jQuery Datepicker不同实例的样式不同 [英] JQuery Datepicker different styles for different instances

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

问题描述

我正在同一页面上的两个地方使用jQuery datepicker.但是我想给他们不同的风格.当他们两个都有相同的班级时,我该怎么做?

I am using jQuery datepicker on two places on the same page. But I want to give them different styles. How can I do that while both of them have all the same classes?

代码:

$('#startDate').datepicker({ dateFormat: "DD, MM d, yy" });
$('#endDate').datepicker({ dateFormat: "DD, MM d, yy" });

这两个日期选择器应该看起来不同.

Both these datepickers should look different.

推荐答案

幸运的是,我在设计上进行了更改.我的日期选择器之一现在必须是内联的,而另一个是普通的日期选择器.我编写了以下代码来实现所需的样式:

Fortunately I got a change in design. One of my datepicker has now to be inline and other one is the normal datepicker. I wrote this code to achieve the desired style:

<input type="text" name="startDate" id="startDate" onclick="applyDatepickerBorder();"/>

在Javascript中,我定义了此方法:

In Javascript I defined this method:

function applyDatepickerBorder(){
    // Inline datepicker doesn't have this id
    $('#ui-datepicker-div').css('border','1px solid');
}

这是我终于得到的:

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

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