Test for browser support of "placeholder" attribute

by alano

JavaScript

$(document).ready(function () {
    //create an empty <input> element and check for placeholder attribute
    if ("placeholder" in $("<input>").get(0)) {
        alert("placeholder attribute IS supported by browser");
    } else {
        alert("placeholder attribute is NOT supported by browser");
    }
});