Answers for "jquery test if input empty"

1

jquery check if input is empty on submit

var empty = true;
$('input[type="text"]').each(function() {
   if ($(this).val() != "") {
      empty = false;
      return false;
   }
});
Posted by: Guest on March-10-2021
2

jquery check if input is empty

if ($.trim($("user_name_intend").val()).length != 0 &&
            $.trim($("user_telephone_intend").val()).length != 0 &&
            $.trim($("user_email_intend").val()).length != 0 &&
            $.trim($("user_comment_intend").val()).length != 0) {
            $.ajax({
                url: "/makeOrder",
                type: "POST",
                data: {
                    quantity: 1,
                    min_quantity: 1,
                    max_quantity: 100,
                    name: $('#user_name_intend').val(),
                    telephone: $('#user_telephone_intend').val(),
                    email: $('#user_email_intend').val(),
                    comment: $('#user_comment_intend').val(),
                    product_id: {{ product_id }},
                },
                dataType: "json",
                success: function (t) {
                    $("#intendformpost").submit();
                },
            });
        } else {
            alert("Kerakli maydonlar to'ldirilmagan")
        }
Posted by: Guest on December-30-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language