Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7413177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:39:21+00:00 2026-05-29T06:39:21+00:00

This question arose when I was working on answering another question about best practices

  • 0

This question arose when I was working on answering another question about best practices for placeholder text in inputs and textareas.

Using the HTML5 placeholder is surely optimal, but at this point in time it still seems necessary to add a degraded solution for older browsers (using javascript).

JsFiddle here : http://jsfiddle.net/leifparker/DvqYU/16/

The question is : Since they both accomplish nearly precisely the same thing, why bother to include both? Why not just utilize the javascript-only solution, and forego the HTML5 implementation until it is (near) universally accepted?

Granted, with this specific example, adding the HTML5 placeholder attribute and the hasPlaceholderSupport() function is a fairly minimal addition of lines (4), but since the degraded support is desired, is there any reason to bother with the progressive redundancy?

I’m sure there is rationale on both sides, and I’m curious to hear it.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:39:21+00:00Added an answer on May 29, 2026 at 6:39 am

    There’s a reason to bother. As time progresses, it’s expected that all browsers will support the placeholder attribute. Right now, just a few browsers do not support it (most importantly, IE 9 and inferior, and the Android Browser). So, eventually, your placeholder fallback code will be unecessary. If you ship the website using the script for all browsers, in a few years, it will be completely unnecessary.

    Instead, by using feature detection for falling back to a JavaScript solution only when necessary:

    1. You do not unnecessarily run a bit of JavaScript code in browsers which already support the placeholder attribute.
    2. You may only load the fallback script when necessary, saving a few bytes.

    This is what libraries such as Modernizr and yepnope.js (included with Modernizr) already do. I’d recommend using Modernizr and extracting your placeholder polyfill to a placeholder-polyfill.js file, so your code could look like this:

    Modernizr.load({
      test: Modernizr.placeholder,
      nope: 'placeholder-polyfill.js'
    });
    

    If you just want yepnope.js and run your own feature detection function(s):

    yepnope({
      test: hasPlaceholderSupport(),
      nope: 'placeholder-polyfill.js'
    });
    

    This way, you save resource loading and improve performance for most browsers. In the future, all browsers would simply pass the test, improving performance. Then, you could simply remove the yepnope.js/Modernizr call.

    For me, it’s more of a mindset about future-proofing your code, while already taking advantage of modern browsers’ capabilities.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In answering this question the question arose as to whether the traditional C meaning
This question arose while reading the new chapter in the excellent Learn You a
This question arose from the discussion in the comments of this answer . First,
This question is a follow up to my previous question about getting the HTML
This question is about removing sequences from an array, not duplicates in the strict
This is a new question which arose out of this question Due to answers,
I'm sorry for a question like this. I'm not too sure about the difference
This is a question that arose mostly of pure curiosity (and killing some time).
This question arose out of something strange that I noticed after investigating this question
Note: this appears to have been fixed in Roslyn This question arose when writing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.