Articles in this section
Category / Section

How to Get Id and Value of the Selected Item in JavaScript ListBox?

3 mins read

How to get id, value of the selected item in ejListBox "select" event?

 

We can get the id, value of the currently selected item of JavaScript ListBox through ‘select’ event’s arguments.

Select event will get triggered when we select a list item.

Please refer the below code snippets.


[_script]

jQuery(function ($) {

 

           $("#select").ejListBox({select:"Onselect"});

 

});

[_script]

function Onselect(args) {

selecteditem_id = args.item.attr("id")

selecteditem_value = args.value;

alert("id of select item : " + selecteditem_id + "\n" + "value of select item : " +selecteditem_value);
}

 

 

 

Conclusion

I hope you enjoyed learning on how to get id and value of the selected item in JavaScript  ListBox.

You can refer to our JavaScript ListBox feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript ListBox example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied