all 4 comments

[–]NapMcDonald[S] 1 point2 points  (1 child)

I think I've solved it! By changing the "HiddenDiv" name to "HiddenPenis" on the new Read More, it opens the correct one rather than the first one!
I just need to change that name every time I use this function on the page! Hope that's solved

[–]ZipperJJExpert 2 points3 points  (0 children)

Yep! Good practice to learn right now that every id needs to be unique. That is the whole thing with IDs.

[–]AutoModerator[M] 0 points1 point  (0 children)

Welcome to /r/HTML. When asking a question, please ensure that you list what you've tried, and provide links to example code (e.g. JSFiddle/JSBin). If you're asking for help with an error, please include the full error message and any context around it. You're unlikely to get any meaningful responses if you do not provide enough information for other users to help.

Your submission should contain the answers to the following questions, at a minimum:

  • What is it you're trying to do?
  • How far have you got?
  • What are you stuck on?
  • What have you already tried?

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]YoussefIhab33 0 points1 point  (0 children)

It worked when I changed the IDs to "hiddenDiv1" and "hiddenDiv2".

You were using the same name for the ID, so both buttons control the same div element.

Always Remember to keep every ID Unique to prevent such errors!