Martin S. wrote:
> However I need to do somehing like this:
>
> a = GetElementById("foo-1");
> b = new SomeClassWhichNeedsAnElement(a);
> b.doSomething();
Usually, you want to perform some operation like above on *every*
element injected. Using jQuery, you would do this:
jQuery(document).ready(function($) {
$(".foo").each(function() {
var b = new SomeClassWhichNeedsAnElement(this);
b.doSomething();
};
});
The selector $(".foo") will generate a list of all elements with the
class "foo". The .each() function will call its argument once for each
of the elements in the list. The element will be passed as "this" to the
function.
-- Remy
signature.asc
Description: OpenPGP digital signature
