Hi
Im trying create a event in javascript to calcule age with birthdate

I add a custom/javascript module in form with this code:
[pre]function calculateage()
{[br] var fecha=document.getElementById("fecha_de_nacimiento").value;[br] var justnow=document.getElementById("nowdate").value;[br] alert("birthdate: "+ fecha+ " Now: "+justnow);[br] [br]}[br][/pre][br]
The problem is when i try pick a date in "fecha_de_nacimiento" the event trigger but don't write nothing in field "fecha_de_nacimiento" and then i can't calculate age in function :/


Im doing something wrong?
Im trying create a event in javascript to calcule age with birthdate

I add a custom/javascript module in form with this code:
[pre]function calculateage()
{[br] var fecha=document.getElementById("fecha_de_nacimiento").value;[br] var justnow=document.getElementById("nowdate").value;[br] alert("birthdate: "+ fecha+ " Now: "+justnow);[br] [br]}[br][/pre][br]
The problem is when i try pick a date in "fecha_de_nacimiento" the event trigger but don't write nothing in field "fecha_de_nacimiento" and then i can't calculate age in function :/


Im doing something wrong?