How to extract values from HTML <input type=“date”> using jQuery

后端 未结 5 1369
无人及你
无人及你 2020-12-16 12:38

Using an HTML input type=\"date\" and a submit button. I would like to populate the variables day, month, and year with t

5条回答
  •  我在风中等你
    2020-12-16 12:57

            
            
    
    
    
    

    Date class will convert input data into date type. Then getMonth() gives us value from 0-11 so we can either consider January as 0 or we can add 1 to received value that's what I did here.

    Here I just used Jquery to fetch date, months and year respectively and if you want to post the data you can convert that values into string.

提交回复
热议问题