I’m trying to add an event listener to an input element within a table and am having trouble getting it to work.
[Code]
10 function coordChange (event)
11 {
12 …
13 }
…
50 row1 = document.createElement (“tr”);
51 latCell = document.createElement (“td”);
52 latCell.appendChild (document.createElement (“input”));
53 latCell.type = “text”;
54 latCell.name = “pointLat”;
55 latCell.id = “pointLat”;
56 var pointLat = document.getElementById (“pointLat”);
57 pointLat.addEventListener (“change”, coordChange, false);
It’s a pretty round abound way to get the <input> element, but every other way I tried:
[Code]
pointLat = document.createElement (“input”);
pointLat.addEventListener (“change”, coordChange, false);
For example, IE told me that the method or property for pointLat was undefined (or something like that).
But, back to the code I have now, when I try to work my page and JavaScript on IE, I get the following:
[Code]
Message: ‘null’ is null or not any object
Line: 57
Char: 7
Code: 0
URI: file://…/myJavascript.js
Any ideas on what I’m doing wrong?