(window.addEventListener) ? window.addEventListener("load", initPlaceholders, false) : window.attachEvent("onload", initPlaceholders); function initPlaceholders() { var inputElements = $$("input"); for (var i = 0; i < inputElements.length; i++) { var e = inputElements[i]; if (e.getAttribute("type") != "text") { continue; } e.onfocus = function() { if (this.title == this.value) { this.value = ""; this.removeClass("placeholderInput"); } } e.onblur = function() { if (this.value == "") { this.value = this.title; this.addClass("placeholderInput"); } } if (e.title == e.value) { e.addClass("placeholderInput"); } } }