Set the value of an input field

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

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

15条回答
  •  無奈伤痛
    2020-11-22 01:44

    if your form contains an input field like

    
    

    then you can write the code in javascript as given below to set its value as

    document.getElementById('id1').value='text to be displayed' ; 
    

提交回复
热议问题