getElementsByClassName updated and revised

Just a small note to those of you who use my getElementsByClassName script: it has been updated for performance reasons and flexibility reasons.

One of the major differences is that tag name and containing element are optional, and if not supplied, will default to * respectively document. This means that the order of the parameters are also changed, so className to look for is the first one, followed by tag and then elm. However, for best performance, I recommend sending in all three parameters as closely specified as possible.

Please try it out and let me know if you encounter any problems. You can copy the new script from the post or download the JavaScript file, where it has been added to the previous ones.

Posted in Developing,HTML5/HTML/XHTML,JavaScript |

Leave a Reply

Your email address will not be published. Required fields are marked *