Hello, help me understand the code, I have not studied anywhere js and so on.
$(document).ready(function(){ //Проверка корректности введенных данных function validateData(){ var errors = new Array(); if( $('input[name="email"]').val() == '' ){ errors.push( 'Поле "Эл. почта" не может быть пустым' ); } if( $('input[name="password-first"]' ).val() == '' ){ errors.push( 'Поле "Пароль" не может быть пустым' ); } if( $('input[name="password-second"]').val() == '' ){ errors.push( 'Поле "Подветржение пароля" не может быть пустым' ); } if( $('input[name="password-second"]').val() != $('input[name="password-first"]' ).val() ){ errors.push( '"Пароль" и "Подветржение пароля" должны совпадать' ); } if( $('input[name="name"]').val() == '' ){ errors.push( 'Поле "Имя" не может быть пустым' ); } if( errors.length > 0 ){ var message = "Внимание:\n"; message += errors.join("\n"); alert( message ); return false; } return true; } /** * Отправка формы при нажатии кнопки "Зарегестрировать" */ $('#register').click(function(){ if( validateData() ){ $('#employer-registration').submit(); dataLayer.push({'registration_employer': 'registration_employer_success'}); } }); }); such is the code. I need to do so that when successful! data level of the datalayer transmitted to the server as well datalayer
dataLayer.push({'registration_employer': 'registration_employer_success'}); I apologize for the stupid questions. HELP Thank.
id='register'. Read about selectors in jQuery - yolosora