html code:
<div id=’jqxListBox’></div>
<div>
<input style=”margin-top: 20px;” type=”button” id=’jqxButton’ value=”Clear the items” />
<input style=”margin-top: 20px;” type=”button” id=’jqxButton1′ value=”get Value” />
</div>
JS Code:
var source = [
“Affogato”,
“Americano”,
“Bicerin”,
“Breve”,
“Café Bombón”,
“Café au lait”,
“Caffé Corretto”,
“Café Crema”,
“Caffé Latte”];
// Create a jqxListBox
$(“#jqxListBox”).jqxListBox({
source: source,
theme: ‘energyblue’,
width: ‘200px’,
height: ‘250px’,
selectedIndex: 3
});
$(“#jqxButton”).jqxButton({
theme: ‘energyblue’
});
$(‘#jqxButton’).on(‘click’, function () {
$(“#jqxListBox”).jqxListBox(‘clear’);
});
$(‘#jqxButton1’).on(‘click’, function () {
var item = $(“#jqxListBox”).jqxListBox(‘getItemByValue’, “Affogato”);
alert(item.label);
});
i first clicked clear button then get value button still it is able to get the value.
Please let me know if you have any work around for this.