How obtain the value of the item clicked in virtual list

Good day, i am using a virtual list:

var virtualList = app.virtualList.create({
  el: '.virtual-list',
  items: items,
  searchAll: function (query, items) {
    var found = [];
    for (var i = 0; i < items.length; i++) {
      if (items[i].title.toLowerCase().indexOf(query.toLowerCase()) >= 0 || query.trim() === '') found.push(i);
    }
    return found; //return array with mathced indexes
  },
  itemTemplate:
    '<li>' +
      '<a href="#" class="item-link item-content">' +
        '<div class="item-inner">' +
          '<div class="item-title-row">' +
            '<div class="item-title">{{title}}</div>' +
          '</div>' +
          '<div class="item-subtitle">{{subtitle}}</div>' +
        '</div>' +
      '</a>' +
    '</li>',
  height: app.theme === 'ios' ? 63 : 73,
});

How i can obtain the value of the - li - selected (clicked)?, for example the title value

Thanks, very much

Add this when VL list itself is in DOM:

$('.virtual-list').on('click', '.item-link', function () {
  console.log($(this).find('.item-title').text())
})
1 Like