⬆️ ⬇️

Once again about Placeholders

Recently on Habré, I skipped several articles that described various ways of implementing prompts in input fields ( 1 , 2 ).

I prefer the second way, because its description was to use the placeholder attribute on input elements.

But one “but” haunted - the script was based on replacing the value property of the element. I think this is not quite right.

So, my “bike” is based on a layer with a hint above the input element. Of course, the obvious disadvantage of this approach is that the DOM-tree grows, and the time spent on creating new elements. But the value value remains "clean."



Google code project http://code.google.com/p/placeholderjs/

Living example


')

Source: https://habr.com/ru/post/74472/



All Articles