Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start with a link disabled

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.

like image 752
Albert Avatar asked Dec 24 '22 10:12

Albert


1 Answers

Just start with no href attribute:

<a id="certificate_enrol_link" class="orange_btn">ENROL NOW</a>
like image 176
ED-209 Avatar answered Dec 27 '22 03:12

ED-209