سؤال

I'm thinking about using HTML5's placeholder attribute. If the browser doesn't support HTML5, I can use jQuery as a fallback. However, what if JS is turned off? How do I handle this using the progressive enhancement philosophy?

هل كانت مفيدة؟

المحلول

Why don't you show an actual <label> element and hide it with js?

// js file
$('label').hide();

That way, without js, they'll see a regular label; with js, the label will be removed and you'll get either your jquery placeholder, or your html5 placeholder.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top