使用jquery更改jquery ui日期选择器的宽度
我正在尝试使用jquery更改jquery Calendar.ui日期选择器的宽度 我目前有:使用jquery更改jquery ui日期选择器的宽度,jquery,calendar,width,Jquery,Calendar,Width,我正在尝试使用jquery更改jquery Calendar.ui日期选择器的宽度 我目前有: <script language="javascript" type="text/javascript"> $(function(){ $('head').append('<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/base/jquery-ui.css" rel="stylesheet
<script language="javascript" type="text/javascript">
$(function(){
$('head').append('<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>');
$(".date").datepicker({ changeYear: true, yearRange: '1900:2050',
changeMonth: true, dateFormat: 'yy-mm-dd'});
$(".ui-datepicker").css("width", "14em");
$(".ui-widget").css("fontSize", "0.9em");
});
</script>
由于某些原因,这似乎无法正确解析。然而,当我在firebug中将该行添加到控制台时,它可以完美地工作
有人知道问题是什么吗
编辑:
在jquery ui中似乎有一个onClick事件,它由.css()方法触发和覆盖。在这一点上,使用样式标记似乎是最快、最简单的解决方案。我看不到其他选择只需添加一个宽度为14em的类!重要的 无论如何,您不应该通过javascript进行样式设置,而是创建一个类并添加该类
$(".ui-datepicker").css("width", "14em");