I am trying to set the value of the input, not the attribute. By set, I mean append because it is a 'multiple' input
The multiple attribute does not apply to hidden inputs.
If you want to append to the value, then read the current value, and include it in the new value.
input.value = input.value + "some other string";
Since you've used PHP-style naming conventions, possibly you want to create an additional input:
const newInput = document.createElement("input");
newInput.name = "test[]";
newInput.type = "hidden";
newInput.value = "some other string";
input.insertAdjacentElement("afterend", newInput);
So the submitted data will be treated as an array of values in whatever is processing it once submitted.
type="file"multipleis only valid for<select>or<input type="file">. And using Vanilla JS you can set/unset attributes assigning the value of the property directlyelement.multiple=true|false.multipleis valid forinput type="file"<select>