Zaznacz pola tekstowe jest puste w jQuery
if ( $("#txt").val().length == 0 )
{
// do something
}
Samir
if ( $("#txt").val().length == 0 )
{
// do something
}
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")
}