Set the value of an input field

前端 未结 15 1889
故里飘歌
故里飘歌 2020-11-22 00:54

How would you set the default value of a form text field in JavaScript?

15条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 01:27

    Try out these.

    document.getElementById("current").value = 12
    
    // or
    
    var current = document.getElementById("current");
    current.value = 12
    

提交回复
热议问题