Title: what's the difference between the same method of combobox and textbox Post by: bartdou on October 26, 2016, 06:21:44 PM 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: Code: <input id="cc" class="easyui-combobox" name="dept" data-options="valueField:'id',textField:'text',url:'get_data.php'"> js code1: Code: $('#cc').combobox('clear'); js code2: Code: $('#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: Code: <form id="fm"> js code1 Code: $('#a').combobox('clear'); or like this: js code2: Code: $('#fm').children('input').each(function() { Code2 has much less lines, is there anything wrong or inappropriate with code2 which leads to the same result as code1? Title: Re: what's the difference between the same method of combobox and textbox Post by: jarry on October 27, 2016, 07:54:54 AM You should call the method regarding the plugin. If you want to clear all the form fields, please call the form's 'clear' method instead.
Code: $('#fm').form('clear'); |