Let's say I want option C preselected when I load the page with a hash value of C appended to the URL (ex. http://www.example.com/#C).
I know how to get the value from the hash, but I'm having trouble on selecting the option.
I tried the following using jQuery:
$('.dropdown ul > li > a:contains("C")').click();
$('.dropdown ul > li > a:contains("C")').trigger('click');
but the value selected on the dropdown menu doesn't change
<div class="dropdown open" style="float:none;margin-top:5px;" id="select-group-0">
<input type="hidden" value="A" name="your-category" id="undefined" class="wpcf7-form-control wpcf7-select wpcf7-validates-as-required">
<a id="contactform_type" class="dropdown-toggle dropdown-toggle-filter fp_input contactform_dropdown" data-toggle="dropdown" href="#">A</a>
<ul class="dropdown-menu dropdown-menu-filter">
<li><a tabindex="-1" data-value="A">A</a></li>
<li><a tabindex="-1" data-value="B">B</a></li>
<li><a tabindex="-1" data-value="C">C</a></li>
</ul>
</div>
.trigger('click')simply calling.click()with no params is the same.