how to get value of input box without id and name field using javascript

后端 未结 5 1938
耶瑟儿~
耶瑟儿~ 2021-01-20 09:35

I have a form with 3 input box and all the input box does not have id, name field in it. So if i enter value in it, How can i check the value of input box without id and nam

5条回答
  •  孤街浪徒
    2021-01-20 10:05

    you can get values by getElementsByTagName and code would be like this

    var inputs = document.getElementsByTagName('input');
    value1 = inputs[0].value;
    value2 = inputs[1].value;
    

提交回复
热议问题