+ 1
How can I give different for ids for a <button> in a while loop?
I have written a while loop in php to echo data from a database. I used an onclick javascript code for the button in the loop to hide photos unless the button is clicked. Now the problem is, since i used an id for the button in the hide function, no matter how much data that is printed, clicking the button only shows one photo(always the first div printed) and the rest don't show anything although when i use the browsers inspect elements, i see the photos in the source code. Thanks very much for ur answers.
4 Answers
+ 1
Ondape Valery please can you attach your code here,
+ 1
https://code.sololearn.com/WYLRNpFN4KFI/?ref=app That's the code Shudarshan Rai
the id is hideplay. The javascript is included. I didnt include the database queries
0
If I understood correctly, maybe use classes instead of ids?
0
Bebida Roja let me try using a class.