IDX when i need use

Hello guys, i got questions about IDX, when is necessary use? Why use?

Hi @natanael.mendes

This attribute is used to distinguish elements with the same selector based on their order in the interface hierarchy. We usually avoid this attribute because if the order of elements change, you will get a wrong element.

Usually, I just use it when I need a Non-Greedy selectors:

1 Like

so the only function of this attribute is distinguish the elements with the same selector?

Basically, yes!

Lets say that you don’t have a reliable selector, e.g HTML sample:

<ul>
  <li></li>
  <li></li>
  <li></li>
</ul>

And you want always get the second LI, you can then use the idx=β€œ2”

<ul>
  <li></li> # <- idx="1"
  <li></li> # <- idx="2"
  <li></li> # <- idx="3"
</ul>
1 Like

thanks for your help @alexandretperez!!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.