jQuery datepicker - 为什么主题样式没有显示? [英] jQuery datepicker - Why is theme styling not showing?

查看:384
本文介绍了jQuery datepicker - 为什么主题样式没有显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用jQuery制作了一个像这样的日期选择器:

I've used jQuery to make a datepicker like so:

<input type="text" id="my_datepicker">

$('#my_datepicker').datepicker();

datepicker工作正常,之前我已多次使用过它。问题是输入元素仍然看起来像普通的文本字段,而当我过去使用它时,它使用了jQuery UI类来设置字段的样式,使其看起来很有光泽并与主题保持一致。

The datepicker is working fine and I have used this several times before. The issue is that the input element still looks like a normal text field, whereas when I have used this in the past, it has used jQuery UI classes to style the field so that it looks glossy and in keeping with the theme.

我使用了firebug来查看哪些clesses已应用于input元素,它只有:

I have used firebug to see which clesses have been applied to the input element, and it only has:

hasDatepicker

而另一个网站上的日期选择器的输入字段是正确设置样式具有以下所有类:

whereas a the input field of a datepicker on another site that is styled correctly has all of the following classes:

hasDatepicker
ui-inputfield
ui-widget 
ui-state-default
ui-corner-all

我看过datepicker docs,但我看不到一个允许你选择加入或退出这个样式的选项,我认为无论如何都会发生这种情况。

I've looked at the datepicker docs, but I can't see an option that lets you opt in or out of this styling and I would have thought that this happen by default anyway.

可以有人告诉我我需要做些什么来启用它吗?

Can anyone show me what I need to do to enable this?

非常感谢。

更新< /强>:

Update:

<input id="dob" type="text" maxlength="45" size="45" />

这是来自现场网站的输入标记。

This is the input markup from the live site as requested.

推荐答案

您是否在主题样式表中进行链接?

Are you linking in the theme stylesheet?

示例:

<link rel="stylesheet" type="text/css" media="all"
      href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/smoothness/jquery-ui.css"    />

这篇关于jQuery datepicker - 为什么主题样式没有显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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