javascript - How to create a html collection of elements located in separate divs -


i need create html collection containing 5 input-elements, type = text.

the html:

<div class="outerdiv">     <label><input type="checkbox" align="middle">         <img src="lorem.jpg" alt="img 1" class="image">     </label>     <div class="innerdiv">         <label>lorem<input type="text" value="lorem"></label>     </div>  </div>    

when this, collection input-elements, want ones has value = text.

innerdivtag = document.getelementsbytagname("input"); 

and when this, 5 separate collections , not aim.

for (i = 0; < outerdiv.length; i++) {   innerdivtag = innerbox[i].getelementsbytagname("input"); } 

you can use queryselectorall

document.queryselectorall("input[type='text']"); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -