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);

Comments

Popular posts from this blog

Data visualization for Roadmap Microsite (Angular and D3.js)

Conceptual design

Four tools for prototyping: Sketch, Figma, Principle, and FramerX