As I am completely new to the world of HTML, I find myself in need of quickly putting together something for work just as a proof of concept. I apologize if this question has been answered previously, but honestly, I wouldn't even know how to start searching for it on my own.
I have provided an explanation of what the current code is doing and what I am aiming to achieve with it. The actual code has also been included, stripped down to its simplest form and embedded as a snippet so you can see its behavior in the present state.
CURRENT STATE
- Click on a topic
- A div opens up displaying default hardcoded information
- If the same topic is clicked again or any other action (like clicking on the hide link), the div closes. Upon clicking any topic again, it displays the same previous information regardless of the selected topic
WHAT I WOULD LIKE IT TO DO
- Click on a topic
- The system takes the topic ID and reads data from a text file specific to that topic (each topic has its own file)
- The div still opens up as before, but now it populates with the newly read data
- If the same topic is clicked again, the div should close
- If the close option is chosen, the div should indeed close
- If another topic is clicked, instead of closing the div, it should read the relevant data from its corresponding file and update the div accordingly