Get list of all input objects using JavaScript, without accessing a form object

前端 未结 3 1279
情歌与酒
情歌与酒 2020-11-29 02:18

I need to get all the input objects and manipulate the onclick param.

The following does the job for links. Looking

3条回答
  •  無奈伤痛
    2020-11-29 02:47

    var inputs = document.getElementsByTagName('input');
    for (var i = 0; i < inputs.length; ++i) {
      // ...
    }
    

提交回复
热议问题