How do I auto-hide placeholder text upon focus using css or jquery?

后端 未结 26 1746
长情又很酷
长情又很酷 2020-11-28 00:39

This is done automatically for every browser except Chrome.

I\'m guessing I have to specifically target Chrome.

Any solutio

26条回答
  •  醉梦人生
    2020-11-28 01:05

    Besides all of above,I have two ideas.

    You can add an element that imitates the palceholder.Then using javascript control the element showing and hiding.

    But it is so complex,the other one is using the brother's selector of css.Just like this:

    .placeholder { position: absolute; font-size: 14px; left: 40px; top: 11px; line-height: 1; pointer-events: none; }
    .send-message input:focus + .placeholder { display: none; } 

    23333,I have a poor English.Hope solve your problem.

提交回复
热议问题