ABi ABi - 2 months ago 4x
ASP.NET (C#) Question

Setting TextBox text as current year

I am trying to set a Readonly textbox2 text property to current year.
I am trying to set textbox2 text by using onchange() property on an above textbox1, this way after changing textbox2 text will be asigned as current year. Now the problem is, I have no idea how to work with date formats in jquery is to.
Here I am doing it like this

but its not giving me year.


You need Date() function to use.


$("#id.ClientID").val(new Date().getfullYear());

If you want to know more about Date() function and its attributes? check this link