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

**URL:** https://discourse.aurelia.io/t/is-there-anything-in-aurelia-v-1-that-wraps-document-getelementbyid/4208
**Category:** Help Requests
**Created:** [May 11, 2021, 11:26am UTC](https://discourse.aurelia.io/t/is-there-anything-in-aurelia-v-1-that-wraps-document-getelementbyid/4208 "2021-05-11T11:26:03Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![norgie](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@norgie](https://discourse.aurelia.io/u/norgie)
#### Post date: [May 11, 2021, 11:26am UTC](https://discourse.aurelia.io/t/is-there-anything-in-aurelia-v-1-that-wraps-document-getelementbyid/4208/1 "2021-05-11T11:26:03Z")

</div>

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’?

TIA

---

<div class="post-metadata">

### Author: ![estaylorco](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/estaylorco/32/1887_2.png) [@estaylorco](https://discourse.aurelia.io/u/estaylorco)
#### Post date: [May 11, 2021, 11:56am UTC](https://discourse.aurelia.io/t/is-there-anything-in-aurelia-v-1-that-wraps-document-getelementbyid/4208/2 "2021-05-11T11:56:09Z")

</div>

What’s wrong with using `document.getElementById`?

---

<div class="post-metadata">

### Author: ![norgie](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@norgie](https://discourse.aurelia.io/u/norgie)
#### Post date: [May 11, 2021, 11:58am UTC](https://discourse.aurelia.io/t/is-there-anything-in-aurelia-v-1-that-wraps-document-getelementbyid/4208/3 "2021-05-11T11:58:14Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zewa666](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/zewa666/32/19_2.png) [@zewa666](https://discourse.aurelia.io/u/zewa666)
#### Post date: [May 11, 2021, 5:12pm UTC](https://discourse.aurelia.io/t/is-there-anything-in-aurelia-v-1-that-wraps-document-getelementbyid/4208/4 "2021-05-11T17:12:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Inawire](https://avatars.discourse-cdn.com/v4/letter/i/ad7895/32.png) [@Inawire](https://discourse.aurelia.io/u/Inawire)
#### Post date: [May 11, 2021, 5:21pm UTC](https://discourse.aurelia.io/t/is-there-anything-in-aurelia-v-1-that-wraps-document-getelementbyid/4208/5 "2021-05-11T17:21:54Z")

</div>

This is not a wrapper, but try reading about [http://aurelia.io/docs/binding/basics#referencing-elements](http://aurelia.io/docs/binding/basics#referencing-elements)

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.

---

<div class="post-metadata">

### Author: ![norgie](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@norgie](https://discourse.aurelia.io/u/norgie)
#### Post date: [May 25, 2021, 7:29am UTC](https://discourse.aurelia.io/t/is-there-anything-in-aurelia-v-1-that-wraps-document-getelementbyid/4208/6 "2021-05-25T07:29:59Z")

</div>

@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.
