Need to implement a javascript function where it calculates the user's age, it informs an alert if it is smaller than 18. The Jquery library along with JSP, where datepicker is automatically loaded given an annotation of the Framework.
►Code Category ✓ JSP
<n:panelGridBootstrap >
<t:property name="dtnascimento" />
</n:panelGridBootstrap>
✓ Javasscript
var esteAno = new Date().getFullYear();
$("input[name='dtnascimento']").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(date) {
var ano = date.split('-')[2]; // ano aqui
var idade = esteAno - ano;
if(idade<18){
alert("Menor de Idade");
}