Search code examples
javajavascriptajaxrichfaces

Get current system datetime by click button


In JSF + RichFaces, I have an inputText and a button, How can I click in a button the datetime system will display on the inputText ? If somebody knows this, please guide me. Thanks.


Solution

  • try this using jQuery, it sets client-side date.

    S("#theButton").click(function{
       var currentDate = new Date();
       $("#theInput").val() = currentDate;
    })