I need to set focus on the last element of a list of text inputs, when I create a new input (the last one).
I tried to use Javascript for this, but I don't know the element Id. Using Chrome Inspector I found an Id in the list, but it doesn't work for the last element of the list, just for the already created ones. Also, I'd like to use setFocus() method from Outsystems UI.
Hi skylucacius,
You can give the inputs a class and use Javascript to get the element id of the last input with that class as an output and use that id as an input for your setFocus action.
If you give the inputs a class "my-input", something like the code below would get you the widget id of the last element with this class:
document.querySelectorAll(".my-input:last-child")[0].id
Kind Regards,João