0

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

1

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

document.getElementById("myAnchor").focus();

https://www.w3schools.com/jsref/met_html_focus.asp

1
  • 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .