Simple Javascript in the section used by popup doesn’t work
-
Hi,
There’s a simple redirect script being used in a Popups for Divi popup, but it doesn’t work. It works perfectly in a test page with no popup.
The script is a redirect to another page and has a counter that counts down to zero, then executes the redirect. The counter doesn’t count. It stays frozen at 9 seconds.
Code is below.<!-- Modify according to your requirements -->
<h3>
Redirecting to duckdev.com after <span id="countdown">10</span> seconds
</h3>
<!-- JavaScript part -->
<script type="text/javascript">
// Total seconds to wait
var seconds = 10;
function countdown() {
seconds = seconds - 1;
if (seconds < 0) {
// Chnage your redirection link here
window.location = "https://duckdev.com";
} else {
// Update remaining seconds
document.getElementById("countdown").innerHTML = seconds;
// Count down using javascript
window.setTimeout("countdown()", 1000);
}
}
// Run countdown function
countdown();
</script>To test the problem, got to https://new.kenlonyai.com/home-2/ and select the slide that is 3rd from last and tap a “Listen” button.
Any idea why this is? Does a hidden section disable JS?
Thank you!The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.