Created
July 23, 2020 21:59
-
-
Save denlunev/6631ef578d1408ed1d147a00c6a0aca1 to your computer and use it in GitHub Desktop.
Vollective 54
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
var hubSpotProductField = 'product_selector'; | |
var dfProduct = document.getElementById('df_products'); | |
document.getElementById('df_products').parentElement.parentElement.parentElement.parentElement.style.display = 'none' | |
var products = document.querySelectorAll('[name=' + hubSpotProductField +']'); | |
Array.prototype.forEach.call(products, function(radio) { | |
radio.addEventListener('change', function(event){ | |
if(event.target.value == 'Product 1'){ | |
dfProduct.selectedIndex = 0; | |
}else if(event.target.value == 'Product 2'){ | |
dfProduct.selectedIndex = 1; | |
}else if(event.target.value == 'Product 3'){ | |
dfProduct.selectedIndex = 2; | |
} | |
dfProduct.dispatchEvent(new Event('change')); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment