Javascript reading html input values

后端 未结 3 835
自闭症患者
自闭症患者 2021-01-07 12:55

I am trying to make a Javascript script that asks the user to enter details about a book, and then it generates an MLA style citation for it. The following is my HTML code.

3条回答
  •  无人及你
    2021-01-07 13:24

    after you select an input element by id with something like:

    var fname = document.getElementById('fname');
    

    you can see its current value through the value property. for example:

    console.log(fname.value);
    

提交回复
热议问题