EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: galcott on April 12, 2023, 12:50:40 PM



Title: Double-click on date box to enter current date
Post by: galcott on April 12, 2023, 12:50:40 PM
Is there a way to enter the current date in a datebox simply by clicking either in the box or on the dropdown arrow?


Title: Re: Double-click on date box to enter current date
Post by: jarry on April 17, 2023, 08:31:12 PM
Please refer to this code.
Code:
var dd = $('#dd').datebox();
dd.next().on('click', function(){
if (!dd.datebox('getValue')){
var opts = dd.datebox('options');
var value = opts.formatter(new Date());
dd.datebox('setValue',value);
}
})


Title: Re: Double-click on date box to enter current date
Post by: galcott on April 18, 2023, 06:31:02 AM
I want to do this for all dateboxes, and on double-click, not single click. I tried this code but it doesn't work.
Code:
$('.easyui-datebox').next().on('dblclick', function(){
  if (!($(this).datebox('getValue'))){
    var opts = $(this).datebox('options');
    var value = opts.formatter(new Date());
    $(this).datebox('setValue',value);
  }
})