Created
January 24, 2017 19:40
-
-
Save sarachisholm/7bc9d717feff9a371931c3ade576a179 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var variantSelectors = generateSelectors(product); | |
$('.variant-selectors').html(variantSelectors); | |
function generateSelectors(product) { | |
var elements = product.options.map(function(option) { | |
return '<select name="' + option.name + '">' + option.values.map(function(value) { | |
return '<option value="' + value + '">' + value + '</option>'; | |
}) + '</select>'; | |
}); | |
return elements; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment