In jquery or plain javascript this would be a no-brainer for me, but I want toe learn more about extjs and I need some help
I have a couple of links that look like this:
<a href="id=25" id="gallery25" class="updMediaResource" title="">
<strong>Gallery 1<br> id:25</strong>
<i class="fa fa-pencil"></i>
</a>
If I click on the link I want to stop the default action and trigger a MODX.action:
ppbMediaManager.select('.updMediaResource').on(
'click',
function(e,t) {
var query = t.getAttribute('href');
console.log(query);
//MODx.releaseLock(MODx.request.id);
//MODx.loadPage(MODx.action['resource/update'], query);
},
this,
{
preventDefault: true
}
);
The problem is, if I click the span or the strong element within the a element, t.getAttribute is null.
The extjs documentation is a bit fuzzy for me.
Among other things.
t.parent('a').getAttribute('href');
Didn't work
Edit: My javascript solution look like this:
if(query == null) { query = event.target.parentNode.getAttribute('href'); }
I'm looking for more elegant solution to get the href attribute with extjs syntax. A solution that doesn't cause the problem in the first place would be even better!
Cheers,
pepebe
[ed. note: pepebe last edited this post 12 years, 5 months ago.]