RetroFed Forums
Your home away from modern life.
[Beginner Help Request] Button that increases by one when clicked and replaces the original value permanently with the new one. Possible with no JS?
Post Reply
AuthorMessage
reallykindasorta slrpnk.net reallykindasorta@slrpnk.net
Joined: 2024-04-19
Quote

My website is html/css only right now and I would prefer to keep it that way even though this is simple to implement with js.

8   Original
TragicNotCute lemmy.world TragicNotCute@lemmy.world
Joined: 2023-06-09
#2 · Quote Reply

You could do some wacky shit with CSS, but it wouldn’t persist on a refresh of the page. You should use JS for this. I’m wondering why you don’t want to?

2
reallykindasorta slrpnk.net reallykindasorta@slrpnk.net
Joined: 2024-04-19
#3 · Quote Reply

You could do some wacky shit with CSS, but it wouldn’t persist on a refresh of the page. You should use JS for this. I’m wondering why you don’t want to?

No legitimate reason, it’s just I avoided it for the rest of the site and would be sad to lose my own challenge.

2
IndigoGolem lemmy.world IndigoGollum@lemmy.world
Joined: 2023-10-09
#4 · (edited) Quote Reply

My own site had no JS at all for like a year, and even now only uses it for optional things. I keep JS disabled by default on sites i don't trust, i shouldn't expect anyone else to be more trusting about it.

If it's just a number, you could probably use , with some CSS to make the "increase" button take up the entire visible space. Maybe make that button transparent so you can see the displayed number behind it but can't click it to type a number. But, like TragicNotCute said, it would reset when the page reloads.

I suspect you can do some cool CSS tricks to adjust other things based on this number, but i have yet to figure stuff like that out. I also am only pretty sure it's possible to style parts of an like that. I still have not got around to styling any of the inputs on my site.

3
0t79JeIfK01RHyzo lemmy.ml 0t79JeIfK01RHyzo@lemmy.ml
Joined: 2024-07-17
#5 · Quote Reply

You can always form submit and do server side processing on the input values. I've seen some complicated things with CSS, but I would just do a form submissions if the goal was no JS.

2
A_norny_mousse piefed.zip A_norny_mousse@piefed.zip
Joined: 2026-02-04
#6 · (edited) Quote Reply

I agree with the previous commenters but fwiw there's a CSS community:

!css@programming.dev

And the possibilities of CSS are getting wilder and wilder.

2
Post Reply
Back to top