easyui datebox 初始化设置当前日期

272 阅读1分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路。 ​

给大家上一段直观明的代码

<div>日期控件:<input type="text" class="easyui-datebox" id="tsrq88_da"></div>


设置默认值

   $(function(){
	   var curr_time = new Date();
	   var str = curr_time.getFullYear()+"-";
	   str += curr_time.getMonth()+1+"-";
	   str += curr_time.getDate()+"-";
	   str += curr_time.getHours()+":";
	   str += curr_time.getMinutes()+":";
	   str += curr_time.getSeconds();
	   $('#tsrq88_da').datebox('setValue',str);
   });

代码如上,希望对小伙伴们有所帮助