Struggling to come up with a JavaScript function to swap webpage content using .style.display = "none" or "block"? The challenge lies in dealing with multiple divs each with different IDs. The goal is to dynamically change content upon button click without reloading the page. Adapting the script to change the ID regardless of its previous state is proving to be quite the hurdle. Simply listing out all IDs and swapping them isn't an option in this case. It's essential for the content to automatically switch to the specific one designated by the button press.
I've experimented with various approaches like utilizing querySelector, substituting the ID with class, and attempting to manipulate attributes with remove / set Attribute methods to no avail. After two weeks of frustration, I'm still stumped on how to accomplish this task.
The concern lingers that bootstrap classes might be causing interference with the functionality...
If anyone has any insights or tips to offer, it would be greatly appreciated!
This being my first post here, I hope I haven't breached any rules unknowingly.
Unfortunately, I can't provide my code as it resides on my work laptop which I inadvertently left behind after completing my tasks.