# Attach point on custom widget gets removed after rendering

**URL:** <https://discourse.dojo.io/t/attach-point-on-custom-widget-gets-removed-after-rendering/31>\
**Category:** Dojo 1.x users\
**Created:** [September 28, 2017, 5:21pm UTC](https://discourse.dojo.io/t/attach-point-on-custom-widget-gets-removed-after-rendering/31 "2017-09-28T17:21:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![erotavlas](https://avatars.discourse-cdn.com/v4/letter/e/b9e5f3/32.png) [@erotavlas](https://discourse.dojo.io/u/erotavlas)\
**Post date:** [September 28, 2017, 5:21pm UTC](https://discourse.dojo.io/t/attach-point-on-custom-widget-gets-removed-after-rendering/31/1 "2017-09-28T17:21:30Z")

</div>

I have a custom widget that contains a textArea. I need to access directly the textArea so I can call resize() function. I placed an attach point on the text area to make it easier to access it from code like this

```
 <div data-dojo-attach-point="formelement" style="position:absolute" tabindex="0" class="fe-label aimwebforms-resizehandle" >
    
     <textarea data-dojo-attach-point="theShape"
               data-dojo-type="dijit/form/Textarea"
               data-dojo-props="trim:false, style:'background: transparent; border:none;'" readonly class="fe-element" ></textarea>
 </div>

```

However when the widget gets rendered on the page, the textArea looks like

```
<div data-dojo-attach-point="formelement" style="position: absolute; left: 156px; top: 193px; width: 42px; border-style: none; border-width: 1px; border-color: black;" tabindex="0" class="fe-label aimwebforms-resizehandle" id="01ef6397-0d0a-4f0a-8c02-c28ed20770b2" widgetid="uniqName_43_2">
    
    <textarea data-dojo-attach-point="focusNode,containerNode,textbox" autocomplete="off" class="dijitTextBox dijitTextArea dijitExpandingTextArea fe-element dijitTextBoxReadOnly dijitTextAreaReadOnly dijitExpandingTextAreaReadOnly dijitReadOnly" tabindex="0" id="dijit_form_Textarea_2" readonly="" widgetid="dijit_form_Textarea_2" value="" rows="1" style="overflow-y: hidden; overflow-x: auto; box-sizing: border-box; background: transparent; border: none; font-family: Arial; font-size: 20px; font-weight: 400; font-style: normal; color: black; text-decoration: none; text-align: left;"></textarea>

<div class="aimwebforms-resizehandle" style="visibility: hidden;"><span class="disableMove aimwebforms-resizehandle-right"></span></div></div>

```

My single attach point

> data-dojo-attach-point=“theShape”

gets removed and replaced with

> data-dojo-attach-point=“focusNode,containerNode,textbox”

This appears to be a bug, existing attach points should not be deleted or replaced, but rather appended to if any already exist.

EDIT: although after using the widget it appears I’m still able to access the attach point I set ‘theShape’ even though it is not visible in the HTML. Is this correct?

---

<div class="post-metadata">

**Author:** ![nicolasiac](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@nicolasiac](https://discourse.dojo.io/u/nicolasiac)\
**Post date:** [October 2, 2017, 5:37am UTC](https://discourse.dojo.io/t/attach-point-on-custom-widget-gets-removed-after-rendering/31/2 "2017-10-02T05:37:16Z")

</div>

Yes this is correct.You will not see your attach point in the HTML.  
This is not a bug.

---

<div class="post-metadata">

**Author:** ![dylan](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dojo.io/dylan/32/5_2.png) [@dylan](https://discourse.dojo.io/u/dylan)\
**Post date:** [October 2, 2017, 1:11pm UTC](https://discourse.dojo.io/t/attach-point-on-custom-widget-gets-removed-after-rendering/31/3 "2017-10-02T13:11:03Z")

</div>

There are ways to retain the attach point, either a mixture of making sure the parent widget includes the `dijit/_WidgetsInTemplateMixin`, using `dijit/_AttachMixin` if you want the markup within your HTML page to actual be the template for a widget, and/or leveraging the `containerNode` attach point to preserve the original markup in your HTML page.

What would help is to know if the provided markup is part of the HTML document or your widget template. If the latter, my guess is that you forgot to include `dijit/_WidgetsInTemplateMixin` in your list of dependencies for your widget.

---

<div class="post-metadata">

**Author:** ![erotavlas](https://avatars.discourse-cdn.com/v4/letter/e/b9e5f3/32.png) [@erotavlas](https://discourse.dojo.io/u/erotavlas)\
**Post date:** [October 24, 2017, 9:50pm UTC](https://discourse.dojo.io/t/attach-point-on-custom-widget-gets-removed-after-rendering/31/4 "2017-10-24T21:50:59Z")

</div>

Ok that’s good to know.

To answer your questions, the HTML markup is part of the widget template. I did include dijit/\_WidgetsInTemplateMixin - not inside that widget itself, it gets inherited from another widget I created as a sort of base class.

Regardless, as long as we can still refer to the attach point as it was defined in the HTML, then its all good.
