For modern browsers :)
var table, inputs, arr; table = document.getElementById( 'test' ); inputs = table.querySelectorAll( 'input' ); arr = [].slice.call( inputs ).map(function ( node ) { return node.id; });
Live demo: http://jsfiddle.net/HHaGg/
So, instead of the for loop, I use the map method - each element of the array (each INPUT node) is replaced by its identification value.
Also note that `inputs.map(... does not work, since inputs is a inputs element - it is an object that looks like an array but not a standard one. To still use the map method on it, we just need to convert it to an array which for us is [].slice.call( inputs ) .
Ε ime Vidas
source share