How to set datetime on datetime-local via jQuery

前端 未结 7 2019
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-18 15:43

I have datetime-local html control on my form and I need to set date and time on it dynamically via JS or jQuery. How can I do it?



        
相关标签:
7条回答
  • 2021-02-18 16:23

    This would do the trick

    $("#publishDate").val("2013-03-18T13:00");
    

    You need to use 2 digits for the month to make your sample work.

    0 讨论(0)
提交回复
热议问题