I have looked at this thread: https://kriesi.at/support/topic/contact-form-select-element-preselect-option-based-on-url/ and it works great – except it chooses the wrong dropdown. Can I in this code choose wich dropdown it should affect?
<script>
(function($){
$(window).load(function() {
var optionToSelect = window.location.hash.match(/\d+$/)[0];
$("#avia_3_1 > option:nth-child("+optionToSelect+")").attr('selected', true);
});
})(jQuery);
</script>
The links I’m using:
http://url_to_contact_page/#option1
http://url_to_contact_page/#option2
http://url_to_contact_page/#option3
Thanks in advance.
Hi Semo-dk,
I’m not 100% sure but I think you should be able to do that with this part of the code:
#avia_3_1
If you inspect the element in question with your browser you will hopefully find its ID, you can then replace the ID in the code.
Best regards,
Rikard
It works! Thank you very much for your fast reply :-)
Hi,
Glad it worked! Feel free to reach out to us again on the forum if you need assistance with anything else.
Best regards,
Jordan