我有ListView中包含按鈕的項目列表。我無法找到一個方法來添加事件偵聽器的按鈕...將事件監聽器添加到ListView中的按鈕 - WinJS
這是代碼:
JS:
downloadsListView = document.getElementById('downloads').winControl
downloadsListView.itemDataSource = JobList.dataSource
downloadsListView.onloadingstatechanged = function() {
var _this = this;
return WinJS.Utilities.query("button.play_pause_button", document.getElementById('downloads')).forEach(function(element) {
console.log(element);
return element.onclick = _this._play_pause_download;
});
};
我可以保證,函數通過控制檯輸出循環按鈕。但點擊按鈕不會觸發任何事情。
我希望有人能幫忙。謝謝:)
如果您的項目中確實存在特定的交互元素,您還可以向您希望允許交互的元素添加「雙贏互動」 –