I didn't learn jquery much befor start using jquery-easyui, so I can not understand the description below totaly.
ComboBox:
Extend from $.fn.combo.defaults. Override defaults with $.fn.combobox.defaults.
Combo:
Extend from $.fn.textbox.defaults. Override defaults with $.fn.combo.defaults.
TextBox:
Extend from $.fn.validatebox.defaults. Override defaults with $.fn.textbox.defaults.so I have question:
There is a method "clear" of combobox, and a same method "clear" of combo/textbox too, what's the difference between them?
html:
<input id="cc" class="easyui-combobox" name="dept" data-options="valueField:'id',textField:'text',url:'get_data.php'">
js code1:
$('#cc').combobox('clear');
js code2:
$('#cc').textbox('clear');
code2 leads to the same result as code1, is code2 a recommended way? If there is just 1 <input> it's ok to write codes strictly in Documentation standard format.
But if there are 20 <input> elements with textbox or combobox or datebox classes together like this:
<form id="fm">
<input id="a" class="easyui-combobox">
<input id="b" class="easyui-combobox">
<input id="c" class="easyui-textbox">
<input id="d" class="easyui-textbox">
<input id="e" class="easyui-datebox">
<input id="f" class="easyui-datebox">
... ...
</form
I want to clear their values and write codes like this:
js code1
$('#a').combobox('clear');
$('#b').combobox('clear');
$('#c').textbox('clear');
$('#d').textbox('clear');
$('#e').datebox('clear');
$('#f').datebox('clear');
... ...
or like this:
js code2:
$('#fm').children('input').each(function() {
$(this).textbox('clear');
});
Code2 has much less lines, is there anything wrong or inappropriate with code2 which leads to the same result as code1?