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

后端 未结 26 1823
长情又很酷
长情又很酷 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:01

    With Pure CSS it worked for me. Make it transparent when Entered/Focues in input

     input:focus::-webkit-input-placeholder { /* Chrome/Opera/Safari */
        color: transparent !important;
     }
     input:focus::-moz-placeholder { /* Firefox 19+ */
       color: transparent !important;
     }
     input:focus:-ms-input-placeholder { /* IE 10+ */
       color: transparent !important;
     }
     input:focus:-moz-placeholder { /* Firefox 18- */
       color: transparent !important;
      }
    

提交回复
热议问题