$(document).ready(function(){ $('.pass_show').append('Показать'); $('.ptxt').on('mousedown', function(){ $(this).prev().attr('type', function(index, attr){return 'text';}) }); $('.ptxt').on('mouseup', function(){ $(this).prev().attr('type', function(index, attr){return 'password';}) }); }); $("#signinsubmitform").submit(function(event){ //alert("alert"); var isValid = true; // do all your validation if need here if (document.getElementById('password').value != document.getElementById('password-repeat').value) { isValid = false; } if (!isValid) { event.preventDefault(); document.getElementById("errmsg").innerHTML = "Введеные пароли не совпадают"; } });