Index [0] means that for an input for example there is no need an ID?

Like is select by count from 0 so that means there is no need an #myidwithinput[0] just input[0] is right?

So is a way to select without ID with count?

Thanks!

Hi design,
can we understand more the context of your question?
thank you

I not understand for example why set an ID for an index like for form tag. Saw in example #formnameidblabla[0] for select first form so why not just form[0] there is why need an ID? As index just with count for first [0] and for second [1] form tags?

Thanks!

If your question is about javascript, then you can use the selector, or not. Depending on the type of query selector you use, you may get a single item, or an array of items. Without seeing the code you’re asking about in context, we’re shooting in the dark.

Generally, id’s are unique. At least, they’re supposed to be. But if someone had done something like document.querySelectorAll("#myidwithinput");, then they’re going to get an array back. Same if they’d done something like $("#myidwithinput");, jQuery by default returns an “array-like” collection of items.

1 Like