Hi Eddie,
We have checked your reported query. We can remove the selected items from Listbox by using the removeItem method. And you can get the selected value of listbox by using the value property. Please check the below code snippet.
Code snippet:
@Html.EJS().ListBox("listbox").DataSource((IEnumerable<object>)ViewBag.data).Render()
<button class="e-btn" id="removeitem">Remove items</button>
<script>
document.getElementById("removeitem").onclick = function () {
var listboxobj = ej.base.getComponent(document.getElementById('listbox'), 'listbox');
listboxobj.removeItem(listboxobj.value);
}
</script> |
For your reference, we have prepared a sample based on your requirement in a button click event. Please check the sample.
Please get back to us, if you need further assistance.
Regards,
Gayathri K