Created
November 24, 2017 08:31
-
-
Save chnbohwr/6c4faed771a1aef2bd0b3cb662603959 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const selectSize = (size) => { | |
| const selector = document.querySelector('#exp-pdp-buying-tools-container > form > div.exp-pdp-size-and-quantity-container > div > div.exp-pdp-size-dropdown-container.nsg-form--drop-down--option-container.selectBox-options.nsg-form--drop-down.exp-pdp-size-dropdown.exp-pdp-dropdown.two-column-dropdown.selectBox-dropdown-menu > ul'); | |
| const children = Array.from(selector.children); | |
| children.forEach(ele => { | |
| const rel = ele.getAttribute('rel'); | |
| if (rel.substring(rel.indexOf(':'), rel.length) === `:${size}`) { | |
| console.log('find ele', ele); | |
| $('select[name="skuAndSize"]').val(rel); | |
| $('#buyingtools-add-to-cart-button').click(); | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment