PDA

View Full Version : How to handle clicks on multiple tags inside a "div" tag-EXTJS



tsensuous.grace
4 Apr 2017, 2:03 PM
Im trying to handle a click event on a `div`.There are 2 separate click events that I need to handle on `div`, one is on element `<a>` and another on element `<span>` I have a psedo code for the if-else conditions depending on what element I have clicked.
below is my function after rendering the page:






afterrender: function() {
Ext.fly('div').createChild({
tag: 'div',
html: "<label class='highlight'> Try the new <a href='#'>Beta version</a><span class='icon-clear'></span></label>"
}).on("click", function(e) {
if (e.target is <a>) {
//do some fun
}else if (e.target is <span>) {
//do some func
}
}, this, { delegate: 'label' });
}


I'm not sure how to check which element was clicked to execute fun depending on that element..Any ideas??