Posts

Showing posts with the label event listener

Adding event listener on the page

Suppose you have an input field and you need FilerTag function be performed each time user types a character. Below are two approaches for this. Native browser approach: if (a.addEventListener) {a.addEventListener("keyup", FilterTags, false)} // firefox else if (a.attachEvent) {a.attachEvent("onpropertychange", FilterTags)} // ie YUI approach: YAHOO.util.Event.addListener(a, "keyup", FilterTags);