1
Reply

Get Current Date & Time using JQuery

Bineesh  VP

Bineesh VP

Sep 6 2013 12:21 AM
8.6k
Sir, I want your help in JQuery DateTime Function.

Please take a look to the following function:-

<script>
function GetCurrentdate()
{
document.getElementById("lbl").innerHTML=Date();
}
</script>
<button type="button"  onclick="GetCurrentDate()" >Display Date</button>
 <asp:Label ID="lbl" runat="server"></asp:Label>
   </form>
</body>
</html>

In this function, I am getting the current date and time in button_Click event.

when I place a <asp:TextBox> instead of <asp:Label>  and  add textbox ID to the getElementById("TextBox1"),  I am not getting the output. why?




Answers (1)