[英]Ext Js add event to html element
如何將 onChange 事件添加到我在另一個組件中呈現的 html 元素
xtype: 'component',
html: {
html: '<input type= "color" />'
},
itemId: 'colorPicker'
},
我想將以下事件偵聽器添加到輸入 elelement:
theInput.addEventListener("input", function() {
<<Do something with theColor value here>>
}, false);
在你的情況下,代碼是這樣的:
html: '<input id=\'colorPickerBackground\' type=\'color\'></input>',
listeners: {
afterrender: function(component) {
var colorInput = component.getEl().down('#colorPickerBackground');
colorInput.on('input', function() {
console.log(colorInput.getValue());
});
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.