gl_dropdown replaces <input> without classname

When using gl_dropdown and you select a value, it replaces the <input> in the DOM with a new one and doesn't copy over attributes such as class(needed for .js- targeting).

this.$dropdown.glDropdown({
  fieldName: 'some-field',
});

Before

<input type="hidden" name="some-field" class="js-some-field">
...dropdown markup...

After

<input type="hidden" name="some-field" value="myval">
...dropdown markup...

I ran into this while developing the dynamic variable list that uses gl_dropdown for the environments dropdown. We then collect the data and send it off by ajax but you can't target the <input> by .js- class because it is gone 😿

Assignee Loading
Time tracking Loading