Click here to Skip to main content
15,359,445 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I made a popup feature, which shows the phone number of a user. I was able to apply this feature to one instance. A single user.

Normally, each user has a unique phone number.

But then, I thought, what if I have lots of users as they come, to my site? How can I automatically apply the same popup feature without writing the same lines of code I wrote for the single user, over and over again?

Please, help me out.

What I have tried:

View code here:[^]
Updated 27-May-22 2:52am
Richard MacCutchan 24-May-22 6:34am
If you want to keep their details permanently then you should use a database to store the details. alternatively keep them in session storage for details you only need while the user is active. However, it is not clear exactly what you are trying to achieve. And finally, if you have problems with your code then please post it (with correct <pre> tags) as part of your question, not in another website.

1 solution

Hello !

you need to separate datas and your html structure.
an array JS does that the good way.

then add on each main-inner tag, both id="user_number" and onclick="show_number(;"

the function show_number ( you already wrote it ) will handle as input the "user_number" and it's tags group id too.

so the selector(user_number) will operate in the function to animate the 'phone reveal' feature.

you're so close !

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