I need to create a form with Javascript to get around a CORS issue (meaning: I cannot submit this form using AJAX because the API I am using does not allow it).
However I am having problems setting the value with Javascript. The following does not work for me:
var form = document.createElement("form");
var formElement = document.createElement("select");
formElement.value = "foo";
formElement.id = "bar";
form.appendChild(formElement);
document.body.appendChild(form);
see jsbin.