Why is value 'not an object' in my javascript?
I am writing a script that is supposed to go through all of the forms on
the page and determine whether or not the value should be changed. In
error console, I get the following error:
Timestamp: 9/8/2013 11:16:14 PM
Error: TypeError: Value not an object.
Source File: http://localhost/admin/transform.js
Line: 22
This is my code:
function transform() {
var forms = document.getElementsByClassName('transform');
for(var i = 0; i <= forms.length; i++){
var inputs = forms[i].getElementsByTagName("input");
for(var ri = 0; ri <= inputs.length; ri++){
if(inputs[ri].type == "text"){
inputs[ri].value = "This is a test.";
}
}
}
}
window.addEventListener("onLoad", 'transform', false);
Line 22 is the event listener. Why is "value" not working?
No comments:
Post a Comment