Need help with onchange of DOM element
Hi,
I'm trying to dynamically create and add an input box with an anonymous Javascript function for handling the onchange event. Here is the DHTML code I'm using:
var myInput = document.createElement("input");
myInput.type = "text";
myInput.id = "myInputId";
myInput.onchange = function() { alert("foo"); }
(I am adding the input appropriately to a td and tr within a table)
However, when I change the contents I'm not getting the alert I expect. I've looked through chapter 6 of the book (after having read it) and can't find anything to help me out in this situation.
What am I doing wrong?
Thanks,
John
|