1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
$(document).on('click', '#send_form_callback', function() { $name = checkString('input[name="form_text_6"]'); $phone = checkString('input[name="form_text_7"]'); $email = checkString('input[name="form_email_8"]'); $comment = checkString('textarea[name="form_textarea_9"]'); if ($name && $phone && $email && $comment) { $('form[name="request_call"] input[name="web_form_submit"]').click(); } }); function checkString(id) { var item = $(id); if (item.val() == '') { item.css('border', '2px solid #da6060'); event.preventDefault(); return false; } else { item.css('border', '2px solid #2b9619'); return true; } } |