mercredi 23 septembre 2020

Javascript noob.. trying to do an If condition on a selected input

I did up a html file based on excel sheet with dropdowns..and one of the conditions is that if someone keys in less than 13500, there will be an alert. I have done that already in the code below. The code works for the 13500.

However there is a second condition i need to put, where one of my other div id changes to 15000, then I would need to change the minimum value to 15000.

The 15000 is placed in another id #s0r12c2 ... I thought if i did below it will work but its not working. Basically i have 2 conditions for the alert to happen

value of #s0r12c2 = 13500, and value of #s0r19c2 < 13500

value of #s0r12c2 = 15000, and value of #s0r19c2 < 15000


$('#s0r12c2').keyup(function() {
        if($(this).val() === '15000') {

$('#sheet1').on('mousemove', function () {
$('#s0r19c2').on('blur', function () {
    var number = $(this).val()
    if (number < 13500) {
        alert("Value entered must be 13,500 or higher. \n Your input has been reset. Please reselect your OutSmart Pro Service.");
        $(this).val('13500');
          window.location.reload();
    }
});
});

Aucun commentaire:

Enregistrer un commentaire