I’m running the site onlineyoga.ch which uses a third party software.
My issue is on the player page:
https://onlineyoga.ch/programs/entspannungsinseln-im-alltag
Since I can’t change the HTML Code, I would like to run a Javascript that auto-clicks the show more button called “Mehr anzeigen”, which I can add to the custom scripts section.
I tried several approaches, but didn’t find a working code:
For example:
// Wait until the DOM is fully loaded
document.addEventListener('DOMContentLoaded', function() {
// Find the button using the class 'button left'
var button = document.querySelector('.button.left ds-button');
// Check if the element was found
if (button) {
// Simulate a click on the button
button.click();
// Display a notification
window.alert("Button has been clicked!");
}
});
The problem is, if I test my scripts in the chrome console, I always get a “undefined” back and the click does not happen. So I can’t go further with this..
See Screenshot of Chorme Script testing with Console
Do you know how I can reach my goal and make this clickable with a Javascript and can sucessfully test it on https://onlineyoga.ch/programs/entspannungsinseln-im-alltag ?