JavaScript adds several functions to the event at runtime

I want to add a function to the OnChange event of a text field at runtime (when the page loads). But if there is already a functio function in the onchange event in the percussive text box, then I need to make sure that both functions will receive the call on the onchange event. How can i achieve this? I am using IE7.

Thank you and welcome, Tanmay.

+4
source share
1 answer

You can use the addEventListener function in this text field

var tb = document.getElementById("textbox"); tb.addEventListener("change", function(evt) { alert(tb.value); }, false); 

But for older versions of IE (IE6) this will not work. For this you can use addEvent

+4
source

All Articles