A watermark that is first deleted when a key is pressed?

is there a watermark jquery plugin that doesn't delete the watermark text when the text is in focus, but first remove the watermark text when the user types something in it?

then the watermark will still be displayed when the first text box is automatically selected.

+3
source share
3 answers

This should be easy to manipulate if you cannot find the exact plugin you are looking for. For example, this plugin has the following as the actual clearMessage event:

input.focus(clearMessage);
input.blur(insertMessage);  
input.change(insertMessage);

What you could just change to say this:

input.keypress(clearMessage);
input.blur(insertMessage);  
input.change(insertMessage);
+2
source

I have the best and easiest solution for this problem

<input value="" placeholder="watermark text:" />
0
source

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


All Articles