TL;DR: How to get an input field value by appending a number to a string?
I was trying to access an array value in jquery but it wouldn't let me reference it.
Next idea is to create 'hidden' input fields and try to get the value based upon the ProductID Number, aka 13 (that is the value from changing a drop down select list).
<input type='hidden' id='SFArray13' name='SFArray13' value='6'/>
var ProductOptionValue = $('#ProductOptionID').find(":selected").val();
$("#ProductOption_value").html(ProductOptionValue); // = 13
var SFArrayProductOptionValue = "SFArray" + ProductOptionValue.toString(); // = "SFArray13"
var ProductSquareFeetFromHiddenValues = $("#SFArrayProductOptionValue").val();
$("#SquareFeetPerBox").val(ProductSquareFeetFromHiddenValues);
the var string: SFArrayProductOptionValue = "SFArray13"
I need to use it like this:
var ProductSquareFeetFromHiddenValues = $("#SFArray13").val();
but I don't know the syntax to be able to use the Product ID number and append it to the SFArray name so I can get the value of the ID input box.