79498931

Date: 2025-03-10 19:06:49
Score: 2.5
Natty:
Report link

After a bit of bashing my head against the wall and giving it some rest, I decided to just put everything in the onchange of the html and work with the value obtained from the select itself (this.value) instead of retrieving it to the app.js since I could not figure out for the life of me a way of doing it with the aforementioned changeLang() function in js file.

var direction = this.value; 
this.value = this.options[0].value; 
location = direction;

It is a bit lazy, but it is a good workaround. Thanks to @UmairSarfraz for the response (I did not realize the thing with the onchange attribute) since it helped me to get to a solution.

PS: Turns out there was indeed someone with a problem the same as mine but I did not find the post at the time of writing this question. Shoutout to the response of @TJCrowder, because not only did he gave the same answer, but also it gave a way of doing that function with an EventListener looking for changes. You can find more details clicking this link

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (1): this link
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @UmairSarfraz
  • User mentioned (0): @TJCrowder
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Th3W31rd0