in iPhone 3 the placeholder works fine in type=“text” fields, but in textarea it does not (it doesn’t disappear when you click on textarea)
(in OSX simulator, it works fine in iPad and iPhone, but in real iPhone placeholder text does not disappear when I click on textarea…(could this be b/c my iPhone is iPhone3?)
again: problem is ONLY in iPhone, and ONLY in textarea… for regular text boxes it works fine, even in iPhone… prob is only with textarea, only in iPhone…
(works fine in FF, Chrome, Safari… in desktop/laptop…)
With the HTML5 “placeholder” attribute, the text only disappears when you start to type, not when you click on the form field.
That page you linked to has two things going on. Firstly, each input and the textarea has a placeholder attribute on it. But secondly, each input (but not the textarea) is targeted by CSS, which is removing the placeholder text when you click on the input:
Without that CSS, you’d get the normal behavior on the placeholder text in the inputs—that is, it would only disappear when you start to type. To get what you want on the textarea also, you’d have to extend that code to this:
(I guess what you’re saying is also that you could, in theory, use the JS that’s here for the older browsers and – just for the textarea – apply it to all browsers… that would work, no? of course it works with CSS, which is much more practical… but well, in theory you could do it with JS, yes?)
Not sure what you are asking there, but a few years ago, before the placeholder attribute, the only way to do this was with JS. Of course, JS is still an option instead of the placeholder attribute, though I think placeholder is much better—even though it doesn’t behave quite as you were expecting.