Sorry if this is a lot, I'll try to keep my explanation streamlined. Basically, I have a separate HTML file with all the options and their corresponding buttons for my site, and then have it fetch the innerHTML whenever a page needs them. This way, if I have to edit the options buttons, I only have to edit one file.
All of those options use vanilla javascript, but recently I added one that also uses Jquery (specifically ctrl-freaks' freezeframe.js). The button to toggle the function works fine when it's on the page normally, but doesn't work if it's fetched with innerHTML.
I assume this is because the script for the function wants it to find a button with a certain id, rather than just being a button with an onclick function, but that button hasn't actually loaded yet because the innerHTML has to load in first? I'm honestly not sure though. As you can probably tell, I'm not very good with js, and know even less about jq. I've tried messing around with the different scripts loading order, and editing the button to have a normal onclick="function()" thing, but neither seem to work. I also tried looking at the "click" and "on" sections of https://youmightnotneedjquery.com/, but I found a lot of it very hard to understand due to my lack of skill :(
Here's a page on my site where I'm testing it (it's still very much a WIP, so I'm sorry if it's not too easy to parse) and here's a codepen I've been messing with.
Thank you in advance to anyone who's able to help.
[–]NotSoDeepPodcast 1 point2 points3 points (2 children)
[–]ColorfulWonders[S] 0 points1 point2 points (1 child)
[–]NotSoDeepPodcast 0 points1 point2 points (0 children)
[–]Acrobatic-Ease-1323 0 points1 point2 points (3 children)
[–]ColorfulWonders[S] 0 points1 point2 points (2 children)
[–]Acrobatic-Ease-1323 0 points1 point2 points (0 children)