EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: wel on January 06, 2016, 05:30:00 AM



Title: Get curent selected value from combo box
Post by: wel on January 06, 2016, 05:30:00 AM
Hi,
I have this combo box:

Code:
<select id="cc" class="easyui-combobox" name="dept" style="width:200px;">
    <option value="aa">aitem1</option>
    <option value="bb">bitem2</option>
    <option value="cc">bitem3</option>
    <option value="dd">ditem4</option>
    <option value="ee">eitem5</option>
</select>
Now if I tried to get current selected value using JQuery I write this

Code:
$('#cc').val();

The problem it always return "aa" no matter what is selected, why is that ?


Title: Re: Get curent selected value from combo box
Post by: aswzen on January 06, 2016, 06:11:40 AM
i think you need to read documentation

to get value use: $('#cc').combobox('getValue');
to get text use: $('#cc').combobox('getText');


Title: Re: Get curent selected value from combo box
Post by: wel on January 06, 2016, 07:00:42 AM
I know about getValue but why I can not use JQuery val() ?