I have a select menu with a link to redirect the customer once he/she selects the option that he/she wants. My question would be: how I can start with the link disabled with javascript to force the customer to select one of the options? Below I paste the code that I have:
<select name="dept" class="select_type" id="PT_Certificate_options">
<option value="#">Select Study Option</option>
<option value="mydomain.com/option1">Distance</option>
<option value="mydomain.com/option2">Part Time</option>
<option value="mydomain.com/option3">Full Time</option>
</select>
<a id="certificate_enrol_link" href="#" class="orange_btn">ENROL NOW</a>
<script type="text/javascript">
$("#PT_Certificate_options").change(function () {
console.log(this.value);
$("#certificate_enrol_link").attr('href', this.value);
});
</script>
Thank you for your time.
Just start with no href attribute:
<a id="certificate_enrol_link" class="orange_btn">ENROL NOW</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With