views:

20

answers:

4

What's the easiest way to get all input fields inside a div without using a javascript library like jQuery? Similar to this jQuery snippet:

var inputs = $('#mydiv :input');
+2  A: 

getElementsByTagName

Aaron Saunders
+2  A: 
document.getElementById('mydiv').getElementsByTagName('input')
Roy Sharon
Most complete answer in shortest time, thanks. Didn't knew of the exsistence of getElementsByTagName.
wroks
+1  A: 

Try:

var inputs = document.getElementById('mydiv').getElementsByTagName('input');
Andrei Serdeliuc
A: 
document.getElementById("mydiv").getElementsByTagName("input");
Joe D