Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I cannot seem to figure out the solution to my problem. Through intense several days of research I've concluded this stack overflow question is similar and may be a solution (http://stackoverflow.com/questions/14408891/getelementbyid-multiple-ids), but with all my trials I still can't seem to implement the solution to my code. http://codepen.io/anon/pen/BNvobY[^]. I've asked the same question many times with variations, but I still keep getting broad answers that never help at all. **My question is**, How can I create multiple ID'S from the script to perform several open-transitons?

***Though I figured out specifically.***
JavaScript
var bodyEl = document.body,
content = document.querySelector('.content-wrap'),
openbtn = document.getElementById('open-button'),
closebtn = document.getElementById('close-button'),
isOpen = false;

They are two buttons shown as three gray dots if you scroll towards the middle of the result screen. The first set of gray dots will open two black boxes. **I do not want that**. I would **only** like the first set of gray dots to **only** open the first box, the second set of gray dots to **only** open the second box, and so on.

I figured this portion of the javascript was what was needed to be altered in order to achieve this, though like I said before I cannot seem to implement the solution. Can some **very bright mind** help me figure this out! no advice please!, just a straight forward answer which solves the problem!
Posted
v3

1 solution

Looking at the link you provided there is a tiny but serious problem there...
Both button elements has the same - 'open-button' - ID...In HTML every element must have different ID, and even some browsers do not force this rule, you will have some unexpected behavior with multiple IDs...
The fix is obvious - use unique IDs...
 
Share this answer
 
Comments
Member 11879486 2-Aug-15 5:50am    
Can you do it for me? and I'll accept your solution, I tried all processes still can't seem to do it.
Kornfeld Eliyahu Peter 2-Aug-15 6:06am    
No. Actually that's your job...
Member 11879486 2-Aug-15 6:18am    
Yes but I've been trying for hours, please be a good soul, I know you've done more difficult task than this, make it a better day for me please.
W Balboos, GHB 2-Aug-15 8:05am    
If its a classroom assignment, it's time you learned that programming takes work - learning how to learn.

If this is paid work for a client of yours and you won't struggle with problems until you defeat them*, then you're in the wrong line of work.

*especially since the answer was handed to you, above.
Sergey Alexandrovich Kryukov 2-Aug-15 8:24am    
The whole idea makes no sense. Just don't do it, adding this attribute to anything. If you really need help, explain your ultimate goal, what you wanted to achieve with that.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900