项目场景:
Easyui的日期控件datebox如果需要将清空值。
问题描述:
其他文章说直接$(‘#id’).combo(‘setText’,‘’);
但这个仅仅是清空文本,并没有清空value,如果你没有点击新的日期更改value的话,提交查询的时候,仍然会提交value。
//仅仅是清空了
$('#openedStart').combo('setText','');
//同时设置value和text,才是真正的情况
$('#openedStart').combo('setValue','');
$('#openedStart').combo('setText','');
原因分析:
EasyUI的datebox控件是由span和Input两个标签组成的,仅设置setText只会改变span的值,并不会改变input的value解决方案:
其他文章说直接$(‘#id’).combo(‘setText’,‘’);
但这个仅仅是清空文本,并没有清空value,如果你没有点击新的日期更改value的话,提交查询的时候,仍然会提交value。
//同时设置value和text,才是真正的情况
$('#openedStart').combo('setValue','');
$('#openedStart').combo('setText','');