I have a dropdown and a textbox. I have populated dropdown with datatypes like number, character, float etc. Based on dropdown value need to validate textbox value
$("#textbox").on("keydown",function (e) { 
    var dropdown_val = $("#dropdown option:selected").val(); 
    if ((e.which < 48 || e.which > 57) && dropdown_val === $.trim('NUM')) {     
        $("#transac_errmsg" + transaction_hid).html("Digits only").show().fadeOut("slow"); 
        e.preventDefault(); 
    } 
    if ((e.which <= 64 && e.which >= 91) || (e.which <= 96 && e.which >= 123) && dropdown_val === $.trim('CHAR')) { 
        $("#transac_errmsg" + transaction_hid).html("Letters only").show().fadeOut("slow"); 
        e.preventDefault(); 
    } 
});
Only first part of if works for me and not other else part. Help me to do this.
 
     
     
    