I am enabling a text field on click of a button. After onblur event on that input text, I want that it should be hidden. Now in the case when button is clicked and input field is shown, without changing any value inn that field, I am clicking away outside. But that field is not getting hidden, because the onblur event never fired from that field as I never touched it after enabling. Hence I want that as soon as the field is enabled, the focus should be on that input element.

Something as :

enter image description here

As against :

enter image description here

Note: This is in reference with a cell of inline edit type of SLDS-table

1 Answer 1


You can try to set the focus by using .focus method in the button click function. Check this fiddle link I have created.



  • Thanks for the answer, but its not working. I tried giving slds-has-focus class to std lightning componnents by default, but its still not working. Does this class doesn't apply to std lightning components
    – Sarang
    Feb 23, 2017 at 9:49

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.