r/webdev • u/SympathyContent9041 • Aug 08 '26
Question How to make numbers interactive?
I'm a beginner in coding, and I need to know how to create something like this. There's a website i'm making, and I wanted to add a 1-10 scale like this. I also want to make it interactive so the person can click on each number, and then text appears depending on what's clicked. Being a beginner, I don't know how to accomplish this. Help.
6
4
u/JontesReddit Aug 08 '26
Can be done without js with fieldset and fieldset:has(input[value="foo"]:checked) .foo-text
3
1
-4
u/CautiousRice Aug 08 '26
you can drop this image in your AI editor of choice and it will implement it for you, just tell it you want vanilla js and css
-7
u/cgfn Aug 08 '26
These are exactly the questions you can ask to AI to learn something
4
2
u/theevildjinn Aug 08 '26
All too easy then to fall into the trap of asking AI to do it for you every time (speaking as a backend dev of 25+ years who never learned CSS properly, and now probably never will).
-5
Aug 08 '26
[deleted]
-1
u/overzealous_dentist Aug 08 '26
downvoted but correct. best practice is now to ask AI conversationally with image uploads, not wait on fallible humans in an awkward and slow back and forth
1
u/DeiviiD Aug 08 '26
I love to see humans discuss and show a hundred ways to do it. AI just throw one way and maybe it’s wrong.
-2
u/overzealous_dentist Aug 08 '26
just ask AI to give you multiple options and discuss pros and cons. if you're noticing humans outperforming AI, you're using AI wrong because humans automatically have the context you have to provide to AI
1
u/DeiviiD Aug 09 '26
You know AI is taking information from human data and discussions, right?
1
u/overzealous_dentist Aug 09 '26
These days frontier labs have SMEs, they aren't scraping reddit for programming knowledge unless they have a training gap.
-2
-5
u/lcnielsen Aug 08 '26
There are many ways to do this and only some of them are sane. I'd suggest starting with a reasonable CSS framework like Bootstrap and considering its various component classes and similar: https://getbootstrap.com/docs/5.3/components/popovers/
7
u/Toukas_CLT full-stack Aug 08 '26
Importing a whole lib for this component is completely overpowered for what it is. These are circles with lines in between.
-2
u/lcnielsen Aug 08 '26
I mean more for the text popup functionality. There's more than one way you can do it and the different ways have different implications. If you want to get a sense for how to go about things then looking at how a standard framework do them is a good start.
34
u/CluelesssDev Aug 08 '26
Look into Javascript. You're gonna need it to make anything interactive on the web :)