JSFiddle - React, Tailwind, and code Playground

by Sam_Butler

HTML

<a href="http://www.example.com/" id="uploadlink">Link</a>



<select name="orderemaillocal" id="orderemaillocal"><option selected="selected"></option><option value="129">[email protected]</option><option value="166">[email protected]</option><option value="11">[email protected]</option></select>

JavaScript

function makeUnClickable() {
    $('#uploadlink').each(function () {
        $(this).data('href', $(this).attr('href'));
        $(this).removeAttr('href');
    });
}

function makeClickable() {
    $('#uploadlink').each(function () {
        $(this).attr('href', $(this).data('href'));
    });
}



$( document ).ready(function() {
    makeUnClickable();
    if($("#orderemaillocal").val()) {
        makeClickable();
    } else {
        makeUnClickable();
    }
    $("#orderemaillocal").change(function() {
        if($("#orderemaillocal").val()) {
            makeClickable();
        } else {
            makeUnClickable();
        }
    });
});