0
![Stack Overflow](http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png)
I think the method you are using is wrong. better to use something as below one:
var inputs = grid.getElementsByTagName("input");
var grid = document.getElementById('<%= grdInvoice.ClientID %>');
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type == "text") {
...