# Move labels below the inputs in Embedded Form

**URL:** <https://community.hubspot.com/t/move-labels-below-the-inputs-in-embedded-form/22870>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [July 14, 2020, 9:00pm UTC](https://community.hubspot.com/t/move-labels-below-the-inputs-in-embedded-form/22870 "2020-07-14T21:00:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rjsnyderdesign](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rjsnyderdesign/32/35493_2.png) [@rjsnyderdesign](https://community.hubspot.com/u/rjsnyderdesign)\
**Post date:** [July 14, 2020, 9:00pm UTC](https://community.hubspot.com/t/move-labels-below-the-inputs-in-embedded-form/22870/1 "2020-07-14T21:00:54Z")

</div>

I’m trying to manipulate the DOM with jquery in the form embed code.

```auto
<script>
 hbspt.forms.create({
 portalId: "xxxxx",
 formId: "xxxx",
 cssClass: '',
 cssRequired: 'form__field required',
 errorClass: 'form__field',
 errorMessageClass: 'error',
 submitButtonClass: 'submitBTN',
 onFormReady: function ($form) {
 $('form').wrapInner('<div class="form-row form_block"></div>')
 $('.hs-form-field').addClass('form-group col-md-12');
 $('input').addClass('form__field');
 $('label').addClass('form__label');
 $(".input input").each(function () {
 var e = $(this);
 e.parent().parent().find('label').insertAfter(e);
 })
 }
 });
 </script>

```

However, I’m running into an issue.

When a field isn’t valid . Then trying to go back into the field to edit, i get the below JS error

```auto
v2.js:4 Uncaught Error: Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.
 at r (v2.js:4)
 at Object.processUpdates (v2.js:1)
 at Object.dangerouslyProcessChildrenUpdates [as processChildrenUpdates] (v2.js:2)
 at s (v2.js:3)
 at a.updateChildren (v2.js:3)
 at a._updateDOMChildren (v2.js:2)
 at a.updateComponent (v2.js:2)
 at a.receiveComponent (v2.js:2)
 at Object.receiveComponent (v2.js:3)
 at u._updateRenderedComponent (v2.js:2)

```

When I remove the label insertAfter() script those go away

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [July 16, 2020, 5:25am UTC](https://community.hubspot.com/t/move-labels-below-the-inputs-in-embedded-form/22870/2 "2020-07-16T05:25:18Z")

</div>

Hey @rjsnyderdesign,

Are you able to get the full error message on the non-minified dev environment?

For now, my current hypothesis is that either the label or var e doesn’t exist which is why it might be throwing a invalid error. Hence, your team should probably explore the option of using a if/else check to see if the element exist. i.e. [Jquery insertAfter only once if element exist - Stack Overflow](https://stackoverflow.com/questions/6183667/jquery-insertafter-only-once-if-element-exist)

---

<div class="post-metadata">

**Author:** ![rjsnyderdesign](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rjsnyderdesign/32/35493_2.png) [@rjsnyderdesign](https://community.hubspot.com/u/rjsnyderdesign)\
**Post date:** [July 16, 2020, 2:32pm UTC](https://community.hubspot.com/t/move-labels-below-the-inputs-in-embedded-form/22870/3 "2020-07-16T14:32:31Z")

</div>

Hi @WendyGoh

I’m not sure show to get the non minified version. That error is coming from the hubspot script:

`<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>`

We’re not getting an error when trying to move the label around. It moves and works well. But, it has something to do with validation of the form.

Thanks for your help!
