EasyUI Forum
July 17, 2024, 10:47:40 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Double-click on date box to enter current date  (Read 1698 times)
galcott
Newbie
*
Posts: 39


View Profile
« 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?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2269


View Profile Email
« Reply #1 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);
}
})
Logged
galcott
Newbie
*
Posts: 39


View Profile
« Reply #2 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);
  }
})
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!