This topic contains 1 reply, has 2 voices, and was last updated by Hristo 7 years, 11 months ago.
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
jQuery UI Widgets › Forums › Lists › ListBox › after clear still i am able to get values
This topic contains 1 reply, has 2 voices, and was last updated by Hristo 7 years, 11 months ago.
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.
Hello wpd,
Thank you for this feedback.
I would like to suggest you a workaround:
$('#jqxButton').on('click', function () {
$("#jqxListBox").jqxListBox('clear');
$("#jqxListBox").jqxListBox({ source: [] });
});
Best Regards,
Hristo Hristov
jQWidgets team
http://www.jqwidgets.com
You must be logged in to reply to this topic.