jquery日期选择器仅显示.css问题的月份 [英] jquery date picker show only month with .css issue

查看:362
本文介绍了jquery日期选择器仅显示.css问题的月份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改datepicker以仅选择月份。
我可以改变这样的css属性这样

 <!DOCTYPE html> 
< html>
< head>
< link href =http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css =stylesheettype =text / css />
< script src =http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js>< / script>
< script src =http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js>< / script>


< / head>
< body style =font-size:62.5%;>

< input class =todaydatetype =textname =todaydate/>
< p>测试段落< / p>
< script>
$('。todaydate')datepicker();


< / script>
< style>
.ui-datepicker-calendar {
display:none;
}
< / style>
< / body>
< / html>

它的工作原理,但是当我想用这样的jquery来改变CSS时,它不起作用>

 < script> 
$('。todaydate')。datepicker();
$('。ui-datepicker-calendar')。css({display:'none'})
< / script>

请帮助我

解决方案假设你想使用jquery隐藏日历,而不是css,因为你的某些奇怪的原因。
你可以试试这个:

  $('。todaydate')。 
$('。todaydate')。click(function(){
$('。ui-datepicker-calendar')。css('display','none');
} );

在这里查看... http://jsfiddle.net/FRQ2D/



它会隐藏日历没有问题,但我'不知道你会如何选择xD(可能有一些blur()magic:P)。



没有事件调用来触发.css(),所以你的编码有坏...


I want to change datepicker to select month only. I can change with change css property like this

    <!DOCTYPE html>
<html>
<head>
  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>


</head>
<body style="font-size:62.5%;">

 <input class="todaydate" type="text"   name="todaydate" />
<p>test paragraph</p>
<script>
    $('.todaydate').datepicker();


</script>
<style>
.ui-datepicker-calendar {
    display: none;
    }
</style>
</body>
</html>

It works, but when I want to change css with jquery like this, it not work

<script>
    $('.todaydate').datepicker();
$('.ui-datepicker-calendar').css({display:'none'})
</script>

Help me please

解决方案

supposing you want to hide the calendar using jquery and not css for some weird reason of yours. you can try this:

$('.todaydate').datepicker();
$('.todaydate').click(function(){
   $('.ui-datepicker-calendar').css('display','none');
});

check it out live here... http://jsfiddle.net/FRQ2D/

it will hide the calendar with no problem, but I'm not sure how you gonna select just the month xD (maybe with some blur() magic :P).

there's no event call to trigger the .css() so your coding there is bad...

这篇关于jquery日期选择器仅显示.css问题的月份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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