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

后端 未结 5 2053
耶瑟儿~
耶瑟儿~ 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:31

    You could use the elements property of the form object which will iterate over just the input elements inside the form:

    for (var i = 0; i < a.length; i++) {
      var e = a[i];
      if (e.type == 'text') {
        f(e.value);
      }
    }
    

提交回复
热议问题