Is there any possible way I can either reference a webflow ID or a custom code variable in an HTML embed or use it as a prefill for a hidden input field?
I tried the following via an HTML element, but unfortunately it did not work…
And once you have your calculated value, you apply that with;
var nights = 3; // calculated value
document.getElementById("nights").setAttribute("value", nights);
Notes;
For getElementByID to work that ID has to be on the element you’re targeting, thus id="nights" on the input.
Creating that input makes life easy, but you have no value initially, thus I set it to blank.
innerHTML is for changing the inner contents of an element like <p></p>. An <input> element does not have content to change. Instead you’re wanting to change the value attribute, thus setAttribute