easyui 1.3.3 日期控件添加清空

本文介绍了如何在EasyUI的1.3.3版本中为datebox和datetimebox日期控件添加清空功能。通过编辑jquery.easyui.min.js文件并进行代码美化,然后找到并修改与'datebox-current'相关的部分,实现了在日期控件中增加清除按钮,从而允许用户快速清空所选日期。
摘要由CSDN通过智能技术生成

easyui有两个日期控件,datebox和datetimebox,分别修改。

打开jquery.easyui.min.js文件,一键美化(ctrl+shift+f),方便加代码。

1.datebox

搜索“datebox-current”,关键代码如下:

var _858 = $("<div class=\"datebox-button\"></div>").appendTo(_856);
$("<a href=\"javascript:void(0)\" class=\"datebox-current\"></a>").html(opts.currentText).appendTo(_858);
$("<a href=\"javascript:void(0)\" class=\"datebox-close\"></a>").html(opts.closeText).appendTo(_858);
_858.find(".datebox-current,.datebox-close").hover(function() {
$(this).addClass("datebox-button-hover");
}, function() {
$(this).removeClass("datebox-button-hover");
});
_858.find(".datebox-current").click(function() {
_854.calendar.calendar({
	year : new Date().getFullYear(),
	month : new Date().getMonth() + 1,
	current : new Date()
});
});
_858.find(".datebox-close").click(function() {
$(_853).combo("hidePanel");
});
加上清空的代码后,如下:

var _858 = $("<div class=\"datebox-button\"></div>").appendTo(_856);
$("<a href=\"javascript:void(0)\" class=\"datebox-current\"></a>").html(opts.currentText).appendTo(_858);
//此处的datebox-ok是easyui自带的样式,我尝试加上datebox-clean的样式,但是没效果
$("<a href=\"javascript:void(0)\" class=\&
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值