knowncoder
New member
Hello, It seems that I cannot show/hide within the HTML <details> tag . I am using the following javascript
`
document.addEventListener('change', function() {
var usaDiv = document.querySelector('.usa');
var canDiv = document.querySelector('.can');
var regionDropdownValue = getCookie('RegionDropdown');
if (regionDropdownValue === 'USA') {
usaDiv.style.display = 'block';
canDiv.style.display = 'hidden';
} else if (regionDropdownValue === 'CAN') {
usaDiv.style.display = 'hidden';
canDiv.style.display = 'block';
} });`
to try and do so and it doesn't work as soon as I nest the <div class="usa"> tag within the <details> tag. Does anybody have a solution or know a work around where I can still use javascript?
`
document.addEventListener('change', function() {
var usaDiv = document.querySelector('.usa');
var canDiv = document.querySelector('.can');
var regionDropdownValue = getCookie('RegionDropdown');
if (regionDropdownValue === 'USA') {
usaDiv.style.display = 'block';
canDiv.style.display = 'hidden';
} else if (regionDropdownValue === 'CAN') {
usaDiv.style.display = 'hidden';
canDiv.style.display = 'block';
} });`
to try and do so and it doesn't work as soon as I nest the <div class="usa"> tag within the <details> tag. Does anybody have a solution or know a work around where I can still use javascript?