mirror of https://github.com/zulip/zulip.git
43 lines
1.6 KiB
JavaScript
43 lines
1.6 KiB
JavaScript
$(function () {
|
|
$('#registration').validate({
|
|
errorElement: "p",
|
|
errorPlacement: function (error, element) {
|
|
error.appendTo(element.parent()).addClass('help-inline');
|
|
/* element is the invalid element. We want to access the control
|
|
* group, which is that element's parent's parent.
|
|
*
|
|
* Adding an error class colours the entire row red.
|
|
*/
|
|
element.parent().parent().removeClass('success').addClass('error');
|
|
},
|
|
success: function (label) {
|
|
/* Similarly, see above comment.
|
|
* Adding a success class colours the entire row green.
|
|
*/
|
|
label.parent().parent().removeClass('error').addClass('success');
|
|
}
|
|
});
|
|
|
|
$("#email_signup").validate({
|
|
errorElement: "p",
|
|
errorClass: "validation-failed",
|
|
errorPlacement: function (error, element) {
|
|
/* element is the invalid element. We want to access the control
|
|
* group, which is that element's parent's parent.
|
|
*
|
|
* Adding an error class colours the entire row red.
|
|
*/
|
|
$('#errors').empty();
|
|
element.parent().parent().removeClass('success').addClass('error');
|
|
error.appendTo("#errors")
|
|
.addClass("text-error");
|
|
},
|
|
success: function (label) {
|
|
/* Similarly, see above comment.
|
|
* Adding a success class colours the entire row green.
|
|
*/
|
|
label.parent().parent().removeClass('error').addClass('success');
|
|
}
|
|
});
|
|
});
|