Check: whether the field is filled
-
Can you tell me that inserting to check whether the field is filled or sending empty safari and IE. I'm standing on the void now, and how do we make sure the field is filled?
<input id="phone" maxlength="20" name="phone" type="text" placeholder='Введите телефон' pattern='8[0-9]{10}' required title="Формат (с цифры 8 и без пробелов): 89061111111" class="placeholder">
Here's the crypt code.
$(function(){ /* Mail */ $('.mail').submit(function(e){ if($.trim($('phone_field_selector').val()) === '') return false; e.preventDefault(); $(this).children('.send').replaceWith("<h5 class='nomargbut'>Спасибо за заявку!</h5><h5 class='nomargbut'>Мы свяжемся с Вами в течение 30 минут</h5>"); $.ajax({ type: 'POST', url: 'sends.php', data: $(this).serialize(), success: function(data){ if(data == "true"){ $('.back, .hide').hide().before('<div class="success">Спасибо за заявку! Мы свяжемся с Вами в течение дня.</div>'); setTimeout("$('.success').fadeOut()", 3000); } } }); }); });
-
Now, as you understand the vainization and the format of the phone are HTML5, which, as mildly as not all the browsers, are well maintained (in any case older versions), there are still many cases where it does not work. I sort of simplified your code a little bit, so I took out the input-outs, because my browser worked it out correctly, return it as you have now, and remove the long text message, also return it, and change the check, in the case of an empty field, sends out the alert, change this action on your need.
http://jsfiddle.net/vz6VU/6/