get all input type text using JavaScript

 

querySelectorAll() 

we can use querySelectorAll() method tp get all input type text.

let inputs = document.querySelectorAll('input[type="text"]');

 

Loop on all input elements using JavaScript

const inputs = Array.from(document.getElementsByTagName('input'));

console.log(inputs);

inputs.forEach(input => {

 console.log( input );
 
});

Tags:

Share:

Related posts