0

I have a cf7 select field:

[select* dropdown_2 id:pakett class:dropdown_2 first_as_label "Choose" "Option1" "Option2" "Option3" "Option4"]

On the same page there are 4 different buttons. When I click on any of these buttons I would like the correct option to be chosen from the field.

<a href="#"><button>Choose Option1 from select</button></a>
<a href="#"><button>Choose Option2 from select</button></a>
<a href="#"><button>Choose Option3 from select</button></a>
<a href="#"><button>Choose Option4 from select</button></a>

I'm thinking of a solution for buttons:

 <a href="#" onClick="document.getElementById('pakett').val($("#pakett option:first").val());">

but it is not changing the options. Any ideas?

user3615851
  • 999
  • 1
  • 15
  • 40

1 Answers1

0

Solution is the following JQuery for each ID and option:

$('#link').on('click', function(){
    $('select.dropdown_2>option:eq(3)').attr('selected', true);
});

found from: use jquery to select a dropdown option

Community
  • 1
  • 1
user3615851
  • 999
  • 1
  • 15
  • 40