Is there anything in Aurelia v.1 that wraps 'document.getElementById'?

Since a post can’t be empty, I’ll include the question in the header: Is there anything in Aurelia v.1 that wraps ‘document.getElementById’?


1 Like

What’s wrong with using document.getElementById?

1 Like

Who said there’s is something wrong with calling getElementById? I’m just curious as to whether Aurelia “wraps” these things or not.

1 Like

There is no wrapper on top of native selector APIs. No benefit would be added by doing so.

1 Like

This is not a wrapper, but try reading about

When I started with Aurelia I was using jQuery to reference the elements within my View Models. ref=“namedElement” exposes (binds) the element to the View Model so you just use it. Once I understood that I stopped using jQuery or getElementById (though I was too far by then to refactor it out of my first too apps).

Hope this helps.


@Inawire I’ve been away from Auralia for a long time and had forgotten about the ref. Works like a charm. Thanks for your help.