How to set datetime on datetime-local via jQuery

前端 未结 7 2023
佛祖请我去吃肉
佛祖请我去吃肉 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.

提交回复
热议问题