document.getElementByIdContains?

Posted by johnshaddad on Stack Overflow See other posts from Stack Overflow or by johnshaddad
Published on 2011-01-03T03:40:16Z Indexed on 2011/01/03 3:53 UTC
Read the original article Hit count: 118

Filed under:

Hello

Is there, by any chance, a way to solve this problem:

I have elements that have IDs such as "x_y_z". The unique part is "x_y", thus there is no two items that have the same combination of x and y..

However, using getElementById won't work because when I do it I only have the "x" and "y" part and not the Z (think of Z as a random incremental counter).

Is there a way around this? So that when I have the "x" and "y" I say something like getElementByIdContains("x_y")?

Thanks!

© Stack Overflow or respective owner

Related posts about JavaScript