Javascript:
$('#check').click(function() {
var x = $("input[id=required]").filter(function() {
return $(this).val().trim() == '';
});
$(x).each(function (index) {
$(this).val('');
$(this).addClass("input-error");
$(this).attr({
"data-toggle": "popover",
"data-container": "body",
"data-content": "Wypełnij to pole",
"data-trigger": "manual"
});
$(this).popover('show');
$(this).keypress(function() {
$(this).removeClass("input-error");
$(this).popover('destroy');
});
});
if(x.length > 0) {
$('html, body').animate({
scrollTop: $(x[0]).offset().top-100
}, 200);
}
});
JSFiddle http://jsfiddle.net/GnRdH/4/