<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<style>
.errorstyle {
border: 1px solid #ff0000;
background: #fff3f3;
}
.popover {
box-shadow: 5px 0px 40px rgba(0,0,0, .2);
max-width: 500px !important;
max-height: 200px !important;
overflow-y: auto;
overflow-x: hidden;
border: 1px solid #ff0000;
background: #fff3f3;
}
</style>
<script>
$(function() {
$('#second').popover({
content: '<p></p>',
html: true,
trigger: 'blur',
placement: 'bottom'
}).on('shown.bs.popover', function () {
var first = +this.form.firstone.value || 0,
second = +this.value || 0;
if(first && second && first <= second) {
$('div.popover-body p').text('The value of first (' + first +') input must be greater than the value of secondone (' + second + ')');
$(this).addClass("errorstyle")
} else {
$('div.popover').remove();
$(this).removeClass("errorstyle")
}
});
});
</script>
</head>
<body>
<form>
<div class="form-group">
<label for="first">First:</label>
<input class="form-control" id="first" name="firstone">
</div>
<div class="form-group">
<label for="second">Second:</label>
<input class="form-control" id="second" name="secondone">
</div>
</form>
</body>
</html>
А нет, так нет.