Answer the question
In order to leave comments, you need to log in
Why is the form submit button disabled on ios?
Site autoredstar.ru
On the iPhone in browsers safari, chrome and opera (others have not checked), the submit buttons are not active. Everything works on PC and Android. What could be the problem?
<form method="post" action="mail.php">
<input type="text" name="name" placeholder="Имя*"/>
<div><span>+7</span><input type="text" name="phone" placeholder="Телефон*"/></div>
<textarea placeholder="Какой автомобиль вы хотите купить?" name="comment"></textarea>
<input class="orange-button" type="submit" value="ЗАКАЗАТЬ КОНСУЛЬТАЦИЮ"/>
<input class="form-title" type="text" name="title" value="Подбор авто: заказ консультации">
</form>
$("form").submit(function (e) {
e.preventDefault();
var name_input = $(this).find("input[name='name']");
var email_input = $(this).find("input[name='email']");
var phone_input = $(this).find("input[name='phone']");
var fullphone_input = $(this).find("input[name='fullphone']");
var field_error = false;
if (name_input.length > 0) {
if ($.trim(name_input.val()).length == 0) {
name_input.addClass('empty_input');
setTimeout(function () {
name_input.removeClass('empty_input');
}, 5000);
field_error = true;
}
}
if (email_input.length > 0) {
if ($.trim(email_input.val()).length == 0) {
email_input.addClass('empty_input');
setTimeout(function () {
email_input.removeClass('empty_input');
}, 5000);
field_error = true;
}
}
if (phone_input.length > 0) {
if ($.trim(phone_input.val()).length == 0) {
phone_input.addClass('empty_input');
setTimeout(function () {
phone_input.removeClass('empty_input');
}, 5000);
field_error = true;
}
}
if (fullphone_input.length > 0) {
if ($.trim(fullphone_input.val()).length == 0) {
fullphone_input.addClass('empty_input');
setTimeout(function () {
fullphone_input.removeClass('empty_input');
}, 5000);
field_error = true;
}
}
if (field_error === true) {
return false;
}
var form_data = new FormData($(this)[0]);
form_data.delete('summary');
var file_data_input = $(this).find("input[name='summary']");
if (file_data_input.prop('files') !== undefined) {
form_data.append('summary', file_data_input.prop('files')[0]);
}
$.ajax({
type: "POST",
url: "mail.php",
cache: false,
contentType: false,
processData: false,
data: form_data,
success: function (raw_data) {
var data = JSON.parse(raw_data);
if (data != null && data.success) {
console.log(data);
$.fancybox.close();
$.fancybox({
href: '#popup-window-5',
tpl: {
closeBtn: '<img title="Close" class="popup-window-closbtn" src="img/popup-window-closebtn.png"/>'
},
'width': '545px',
});
} else {
$.fancybox.close();
$.fancybox({
href: '#popup-window-6',
tpl: {
closeBtn: '<img title="Close" class="popup-window-closbtn" src="img/popup-window-closebtn.png"/>'
},
'width': '545px',
});
}
},
error: function (data) {
console.log(data);
$.fancybox.close();
$.fancybox({
href: '#popup-window-6',
tpl: {
closeBtn: '<img title="Close" class="popup-window-closbtn" src="img/popup-window-closebtn.png"/>'
},
'width': '545px',
});
}
});
return false;
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question