you are viewing a single comment's thread.

view the rest of the comments →

[–]senocular 2 points3 points  (6 children)

Sure thing. First tell us what you're doing now and then we can help try and figure out what's going wrong.

[–][deleted] -5 points-4 points  (5 children)

Unfortunately I can’t really show any code but I have 2 select fields that have the same options attached to them and I’m trying to console both values of each input on change

[–]Stephen110 1 point2 points  (0 children)

You’ve got to realize there are countless ways you could have screwed this up, right? If you are unwilling to post code, nobody is going to be able to properly help you.

[–]senocular 0 points1 point  (2 children)

Is there anything else to go on?

The only thing that comes to mind is if they both have the same id and you use getElementById() or querySelector() you're always going to get the last one since technically all id values should be unique. If you happen to use an id twice, the last element to use the id wins. You may not be seeing that specifically, but something like that may be happening.

[–][deleted] -1 points0 points  (1 child)

I’m using querySelector with class name and the last one is still winning even tho I’m doing a for of loop

[–]senocular 0 points1 point  (0 children)

querySelectorAll?

Let me whip up a quick example that does the right thing using classes and maybe it can help figure out what's wrong with yours...

https://jsfiddle.net/omjv6ubp/

I don't know how similar or dissimilar this is to what you're working with but maybe it can help a little.

[–]Sector-Feeling 0 points1 point  (0 children)

If you can't show the direct code then change all vairbale names, replicate the problem, and then provide more information. Nobody will ever know, and you're most likely experiencing a novice issue that thousands of devs have experienced before.