Skip to content
Advertisement

Make a dropdown selection according to the selected div (with jQuery)

I have these divs (links) that can be clicked on.

I want to change a dropdown selection accordingly.

So if it’s clicked on select2, it would change the dropdown value to 666

If select3, it would change to 667

and so on.

I can’t modify dropdown values, however the target id’s CAN be exact as dropdown values, if that will make things easier to code.

I know there are some mistakes in my jQuery script.

Any help would be appreciated.

JavaScript
JavaScript

Advertisement

Answer

well, your Jquery code is a bit wrong, you need to add the select values to the <a> (maybe in data attributes), then set a listener on <a> fields that will trigger a function to change the select value
the full code will be like this :

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement