You can iterate through the array of values, then check each input based on the product ID.
.forEach() documentation
.prop() documentation
View the original article here