I need to get attributes of the event.target
in a Lightning Component's controller, like if I click on <a href...>
in component, I need to get the value of href in controller. How to get this?
Lightning - How to to get attributes of the event.target on press event in a component's controller?
-
did u try using plain javascript getAttribute method ? w3schools.com/jsref/met_element_getattribute.asp– Vamsi Krishna GosuJan 8, 2016 at 12:13
-
@VamsiKrishna it worked. Thanks. Please post as answer so that I can mark it!– VignexJan 8, 2016 at 12:41
1 Answer
To get an elements attribute value, you can simply use the native Javascript getAttribute method.
element.getAttribute(attributename)