js implements the method of getting the same page elements as name and iterating through them

  • 2021-07-21 06:49:10
  • OfStack

Examples are as follows:


<input type="hidden" name="blues" value=" Blue Liuyang River is the best ">


<input type="hidden" name="blues" value=" Relatives of Blue Liuyang River ">


<input type="hidden" name="blues" value=" Love of Blue Liuyang River ">


<script type="text/javascript">


$("input[name='blues']").each(function(j,item){
   //  The business logic you want to implement 

   console.log(item.value); // Output input  In  value  Value to the console 
});


</script> 


Related articles: