locked
If any textbox has Data, show a div RRS feed

  • Question

  • User360451555 posted

    Am trying to loop through a table and check if any of them has an input that is numeric, then show a div, otherwise hide it....but it shows and sometimes it doesnt.

    Here is how am tryna solve it. 

    $("[id$='itemsTable']").find("input[type='text']").not("[id$='txtQty']").each(function () {
         $(this).on("keypress keyup", function (event) {
    
         $("[id$='itemsTable']").find("input[type='text']").not([id$='txtQty']").each(function () {
             if ($.isNumeric($(this).val())) {
                 $("#printDiv").removeClass("hidden");
              }
              else {
                 $("#printDiv").removeClass("hidden");
                 $("#printDiv").addClass("hidden");
              }
           });
        });
    });

    Monday, August 27, 2018 9:27 PM

Answers

  • User360451555 posted

    well, i have modified the code like below and got it to work

    $("[id$='itemsTable']").find("input[type='text']").not("[id$='txtQty']").each(function () {
        $(this).on("keypress keyup", function (event) {
    
            $("[id$='itemsTable']").find("input[type='text']").not("[id$='txtQty']").each(function () {
    
                if ($.isNumeric($(this).val())) {
                    $("#printDiv").removeClass("hidden");
                    return false;
                }
                else {
                    //$("#printDiv").removeClass("hidden");
                    $("#printDiv").addClass("hidden");
                    //return false;
                }
            });
        });
    });
    

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 27, 2018 9:53 PM