windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

Polymer – Bind events to dynamically created elements

Asked By: Anonymous

I’m trying to create a polymer component that will make an ajax call and populate a list based on the response, and I’d also like to add a click / tap event to each list element to do something when I click on a list item.

I create the list like so:

  populateList: function(items) {
    if (items.length == 0) {
    var menu = this.$$('.mp-Autocomplete-dropdown-menu');
    var node = null;

    for (var k = 0; k < items.length; k++) {
      node = document.createElement('li');
      node.setAttribute('class', 'style-scope mp-autocomplete');
      node.setAttribute('tabindex', '0');

      node.innerHTML = items[k];
      this.listen(this.$$('li'), 'click', '_itemTapHandler');


But the ‘listen’ doesn’t work, and I can’t find anything else in the polymer docs which might help me – without going outside the component and invoking straight js on the complete document, which would not be good …… Can anyone help me ?



Answered By: Anonymous

this.$$('li') always returns the first <li> element in your element, that is probably not what you want.

Use instead:

this.listen(node, 'click', '_itemTapHandler');

and if you want to remove it later

var node = ... /* get reference to node */

this.unlisten(node, 'click', '_itemTapHandler');

See also

techinplanet staff

Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno
Alanya escort Manavgat escort Fethiye escort Kemer escort Didim escort Gaziantep escort Denizli escort Adana escort Hatay escort Aydın escort İzmir escort Ankara escort Antalya escort Bursa escort İstanbul escort Kocaeli escort Konya escort Muğla escort Malatya escort Kayseri escort Mersin escort Samsun escort Sinop escort Tekirdağ escort Eskişehir escort Yalova escort Rize escort Amasya escort Balıkesir escort Çanakkale escort Bolu escort Erzincan escort Şırnak escort Van escort Yozgat escort Zonguldak escort Afyon escort Adıyaman escort Bilecik escort Aksaray escort Ağri escort Bitlis escort Siirt escort Çorum escort Burdur escort Diyarbakir escort Edirne escort Düzce escort Erzurum escort Kırklareli escort Giresun escort Kilis escort Kars escort Karabük escort Kırıkkale escort Mardin escort Kırşehir escort Maraş escort Manisa escort Muş escort Kastamonu escort Ordu escort Nevşehir escort Sakarya escort Osmaniye escort Şanliurfa escort Sivas escort Trabzon escort Tokat escort Ardahan escort Bartın escort Karaman escort Batman escort Bayburt escort Bingöl escort Elaziğ escort Gümüşhane escort Hakkari escort Isparta escort Uşak escort Igdır escort