Reputation: 23
I'm having problems understanding how to get the index (or the item) of the selected item in paper-dropdown-menu. At the moment I have an eventlistener whenever core-select is fired:
window.addEventListener('polymer-ready', function(e) {
var menu = document.querySelector('paper-dropdown');
menu.addEventListener('core-select', function(e) {
console.log(getSelection());
});
Upvotes: 2
Views: 2868
Reputation: 24109
According to the docs (https://www.polymer-project.org/docs/elements/paper-elements.html#paper-dropdown-menu), the event has and .item
property with the selected item.
menu.addEventListener('core-select', function(e) {
console.log(e.detail.item);
});
Upvotes: 3