JavaScripting

The definitive source of the best
JavaScript libraries, frameworks, and plugins.


  • ×

    Placeholder Shiv

    Tiny polyfill for the placeholder form element attribute. Requires Prototype.js.
    Filed under  › 

    • 🔾4%Overall
    • 27
    • 326.4 days
    • 🕩7
    • 👥3

    placeholder-shiv

    Tiny polyfill for the placeholder form element attribute. Requires Prototype.js or jQuery.

    This Prototype JavaScript simulates the placeholder attribute in browsers that do not support it yet. It doesn’t do anying if placeholders are supported, and degrades to show nothing if both placeholder and JavaScript support are missing.

    To apply it, simply code your form elements with placeholders, and add a link to prototype.js and placeholder-shiv.js or jquery.js and placeholder-shiv.jquery.js in the head of your page.

    The only caution is that the placeholder text cannot be exactly the same as a potential actual input value. Pad the placeholder value with trailing spaces to avoid this issue.

    Show All