Skip to content

Instantly share code, notes, and snippets.

@bulnak
bulnak / initPlaceholder.js
Last active October 12, 2015 20:48
support placeholder tag for unsupporting browser with jQuery val function overriding
function initPlaceholder() {
if (!("placeholder" in document.createElement("input"))) { // Browser 지원여부 체크
var $input_placeholder = $("input[placeholder]");
$input_placeholder.each(function () {
$(this).focus(function () {
if ($(this).val().trim() == "") {
$(this).css("color", "").val("");
}
}).blur(function () {
if ($(this).val().trim() == "") {