JavaScript gets and changes the methods for the input tag name attribute

  • 2020-06-22 23:53:41
  • OfStack

This article is an example of how JavaScript gets and changes the input tag name attribute. Share to everybody for everybody reference. Specific implementation methods are as follows:

<input name="kk"></input>

<script language="javascript">
//  Here with getElementsByTagName Put all the input Object extraction ,
// This is the crux of the matter , with ByTagName Rather than ByName . 
var list = document.getElementsByTagName("input");
//  I'm going to break down this set, which includes everything input . 
var inputList = document.getElementsByName("kk");
// test 
//  So here's what pops up 'kk' Of course, you can also output other items as needed. 
// Such as: list[i].id; list[i].value And so on. 
alert(list[i].name);//  This is changing the value 
list[i].name = 'mm';//  So this is what pops out 'mm' the 

Hopefully, this article has been helpful in your javascript programming.

Related articles: