Created
March 30, 2012 21:29
-
-
Save dmvk/2255273 to your computer and use it in GitHub Desktop.
jquery live form validation for bootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nette.addError = function(elem, message) { | |
var group = $('#' + elem.id).closest('.control-group'); | |
group.removeClass('error'); | |
group.find('.help-inline').remove(); | |
if (message) { | |
group.addClass('error'); | |
group.find('.controls').append('<span class="help-inline">' + message + '</span>'); | |
} | |
}; | |
$(function () { | |
$("form :input").focusout(function() { | |
if(Nette.validateControl(document.getElementById(this.id))) { | |
$(this).closest('.control-group').removeClass('error').find('.help-inline').remove(); | |
}; | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment