Daniel Eben Elmore a écrit :
Ah, yes that code looks like it would check an element
individually/explicitly. I think? But what about returning all elements in
the document as an array like the getElementsByClassName function does? I
suppose I could just modify the function, but didn't know if
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Daniel Eben Elmore wrote:
Is there a function like getElementsByClassName where I can use regex to
match the class names?
There's no such sugar currently implemented in Prototype, but, as Aaron
showed you already, it's quite easy to implement.
Am afraid its quite late (early?) and I haven't had time to check it
but you could try something like this?
function checkClassName(el, regEx) {
el = (typeof el == string) ? $(el) : el;
return el.className.match(new RegExp(regEx));
}
var elements = [ myElement1, myElement2,
.
Thanks
Daniel
-Original Message-
From: rubyonrails-spinoffs@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Aaron B
Sent: Thursday, January 18, 2007 11:48 PM
To: Ruby on Rails: Spinoffs
Subject: [Rails-spinoffs] Re: getElementsByClassName starting with...
Am afraid its quite late