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 there was a more elegant way.
Thanks Daniel -----Original Message----- From: [email protected] [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 (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", "myElement3", "myElement4" ]; for (var i = elements.length-1; i >= 0; --i){ if(checkClassName(elements[i], "##RegEx##")) { // Do stuff } else { // do other stuff } } On Jan 19, 2:50 am, Daniel Eben Elmore <[EMAIL PROTECTED]> wrote:
Is there a function like getElementsByClassName where I can use regex to match the class names? I want to match class names starting with ... -Daniel
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
