Friday, June 28, 2019

javascript - In Ext JS, how to attach events to dynamic html elements?

Suppose I have some Ext JS code that attaches an event handler to all elements with class "myclass". For example:



Ext.onReady(function(){
Ext.select('a[class*=myclass]').on('click', function(event, elm){
// do something
});

});


And my html might be as follows:



test1
test2
test3



That works with no problem. However, consider if the "myclass" elements were written to the page at some future time.



For example:



create link dynamically

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...