Would appreciate your help with this.
I’m trying to get the site to automatically click on a button, when the site is loading.
The button I’m referring to is the blue one, above the fold right when you enter the page,
the text is "Full 2022-2023 Schedule".
Site is running Elementor on WordPress.
Any ideas?
I tried adding this script to the homepage of the site www.thenflschedule.com,
but it just doesn’t work.
<script type="text/javascript">
document.getElementById("button").click();
</script>
Update:
There’s a script on the page to open popups only when the window or any element is clicked. I thought that by auto-clicking a button, it would trigger the popup, but it doesn’t. I would still need to click manually anywhere on the page for the pop up to open.
Is there a function to click anywhere on the window, that would trigger the popup script?
This is the pop up script that’s running on the page:
<script data-cfasync="false" src="//acacdn.com/script/suv4.js" data-adel="lwsu" cdnd="acacdn.com" zid="323555"></script>
2
Answers
Thank you Viraj, looks like it's working now, but it doesn't do what I thought it would.
There's a script on the page to open popups only when the window or any element is clicked. I thought that by auto-clicking a button, it would trigger the popup, but it doesn't. I would still need to click manually anywhere on the page for the pop up to open.
Is there a function to click anywhere on the window, that would trigger the popup script?
This is the pop up script that's running on the page:
<script data-cfasync="false" src="//acacdn.com/script/suv4.js" data-adel="lwsu" cdnd="acacdn.com" zid="323555"></script>
The button doesn’t have an ID called "button". You can only use
.getElementById
when the element you are trying to access has anid
parameter.Try using
That button (actually its a link tag) has the above classes thats why I have used
.getElementsByClassName
instead of.getElementById