value of input type time in javascript

前端 未结 1 1278
梦谈多话
梦谈多话 2021-01-15 19:15

I have this html:


js:

var time = $(\'#time\').val();
console.log(time         


        
相关标签:
1条回答
  • 2021-01-15 20:16

    Try using valueAsDate property

    $("input[type=time]").on("change", function() {
      console.log(this.valueAsDate)
    })
    <input required="" id="time" type="time">
    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

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