I have Range/Number type inputs that are synchronized and dynamically generate input fields as much as their values.
Then I have a button that will fill the generated input fields with an arbitrary value.
The dynamically generated input fields each have unique IDs, but the document.getElementById() function fails to find any of the IDs and returns null.
Is there a way to change the value of the generated fields within the randomizeItemTypes() function?
function randomizeItemTypes(textbox) {
var rackNum = textbox.replace("itemSlider", "").replace("numOfTypes", "");
var numOfTypes = document.getElementById("numOfTypes1").value;
for (var i = 0; i < numOfTypes; i++) {
document.getElementById("rack" + rackNum + "." + i).value = 4;
}
}
The following link is the CodePen to my code: http://codepen.io/cnc4ever/pen/LGNMEp
Thanks guys!
document.querySelector) and then you'd need to escape those dots