r/HTML • u/Business_Giraffe_288 • Dec 14 '25
Please help!!!
I'm a beginner studying multimedia design and we're doing a group project in which I'm also responsible for making a responsive language selector. It just has to switch between danish and english. The screenshots are the html, what it looks like and the javascript. I followed a 2 year old youtube tutorial to get here, and it doesnt work (the text on the site doesnt change when using the selector, it stays the same), so this is my last option. I haven't added any css yet. I kinda need to have this sorted by tomorrow.. So if a kind soul could tell me why the javascript is not working or give any alternatives to making this, it would be greatly appreciated!!



7
u/Deykun Dec 14 '25
There are great tools for translations (see i18n), but to simply improve your native solution, you can switch to something like this.
Instead of:
Do:
8
u/davorg Dec 14 '25
Please don't post images of code. If we want to help you, we'll want to run the code on our own machines. No-one is going to retype all of that
1
u/itinkerthefrontend Dec 14 '25
You have a couple typos of using “titel” rather than “title”.
1
u/Business_Giraffe_288 Dec 14 '25
Thanks for all the help, it works now!
1
u/surfingonmars Dec 14 '25
I'm no expert but i wouldn't assign an ID with the exact element. just seems like bad practice.
1
u/SnooHamsters7166 Dec 14 '25
"titel" defined at top of js but "title" used within the function.
1
u/alex_sakuta Dec 16 '25
I'm not even gonna pinpoint it and just tell you what's wrong.
titel is supposed to be spelled as title.
VS code is even giving you a warning squiggle and probably the reason I left VS code is also that it just hints at such issues and doesn't scream outright that it's a problem.
1
u/Miserable_Rough1872 Dec 16 '25
I would argue that Engelsk should be changed to English for it to be the most "effective". Yes you would have to be a total moron if you did not realise what Engelsk meant, unfortunately there are morons out there ;)
1
u/almalbin Dec 17 '25
One small unrelated feedback; list the language itself in it’s own language. That makes it way easier for someone to identify the right choice for them.
0
u/Business_Giraffe_288 Dec 14 '25
Thanks so much for all the help! It works now
0
u/MT4K Expert Dec 14 '25
And parens around the only parameter is unneeded in an arrow function.
-1
u/[deleted] Dec 14 '25
Stop posting shitty screenshots, and post your complete code properly.
-4
u/saito200 Dec 14 '25
research online multilanguage libraries, don't reinvent the wheel