Hello,
I’m trying to add some dynamic-loading content on my site mixing a <select> for a dropdown menu and a <script> for hiding some divs and showing the choosen one.
Both work perfectly fine when I’m logged in into wordpress, but don’t when I’m not. The relevant content is destined for non registered users so it must work without loging in.
In summary, I’m using two content areas.
a first one with the <select> and the divs
and a second one with a <script>
First content area has:
<select id="target" name=lista-tv-comunidades> <option value="">Select...</option> <option value="content_1">Option 1</option> <option value="content_2">Option 2</option> <option value="content_3">Option 3</option> <select>
<div id="content_1" class="inv">Content 1</div>
<div id="content_2" class="inv">Content 2</div>
<div id="content_3" class="inv">Content 3</div>
Second content area has:
<script> document .getElementById('target') .addEventListener('change', function () { 'use strict'; var vis = document.querySelector('.vis'), target = document.getElementById(this.value); if (vis !== null) { vis.className = 'inv'; } if (target !== null ) { target.className = 'vis'; } }); </script>
When logged out, all it shows is the content of said tags as plain text.
How can I solve this?
