I am trying to pass data from my inputfield to my onkeyup event, but it doesn't work.

I have a simple field:

<lightning:inputField fieldName="Name" onkeyup="{! c.onmouseup}" data-tab="information"/>

I have a simple handler:

onmouseup : function(component, event, helper) {
    var ctarget = event.currentTarget;
    var tab = ctarget.dataset.tab;

It say ctarget is null, what am I doing wrong?


1 Answer 1


This is the model I've found to work:

onmouseup : function(cmp, event, helper) {
  let tab = event.currentTarget.getAttribute('data-tab');
  • 1
    I worked around the problem by not passing value and redesign the system but I'll mark this answer as correct for others. Mar 25, 2021 at 19:57
  • Sounds great, thanks! Mar 26, 2021 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.