Tutorial :JavaScript add multiple function to event at runtime


I want to add a function to OnChange event of textbox at runtime ( on page load). But if there is already a functio define at onchange event of the perticular textbox then i need to make sure the both function get a call at onchange event. How can I achive that? I am using IE7.

Thanks and regards, Tanmay.


You can use the addEventListener function on that textbox

  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 that you can use the addEvent

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »