getElementByName parameter
Hello everyone
Just for example, instead of using MS's mynode.all to get a collection of all the elements inside some node we use mynode.getElementsByTagName("*").
I am wondering: is there a simple and short way to get desired element by its name using name pattern (something like getElementsByName("myName*") for ex.)?
Thanks in advance =)
P.S. Please, don't offer iterations through the elements with name comparison... :p
Re: getElementByName parameter
Of course there is...
Code:
document.getElementsByName()
Remember that multiple elements can have the same name. Therefore, this will return an array, not just the actual element object.
Re: getElementByName parameter
Quote:
Of course there is...
Khmm, khmm...
LOL! Ok, my mistake I should have foreseen this... =)
But I wonder... How could you, after all this time, even assume this...
Look at this thread title... See anything there? Ok, ok, I've just missed 's' there (quick typing, you know...) :D
Just kidding. I know this method. My question was about its parameter. Or any other similar solution using some other method.
Re: getElementByName parameter
We all make mistakes...I just read your post too fast.
The correct answer is no. No wildcards exist in this circumstance. You are going to have to walk the DOM recursively toget this, or weed through the arrays returned by getElementsByName.
Re: getElementByName parameter
:sick:
Will write my own method then...