Password field default value

前端 未结 7 2303
野的像风
野的像风 2021-01-06 09:22

How can I both use the HTML password input and set a text default value that will be readable since the password input will turn the characters into dots or stars? Can I do

7条回答
  •  鱼传尺愫
    2021-01-06 09:57

    In head:

        function Changetxt() {
            if ($('#pwd').val() == "Enter Your Password Here") {
                $('#pwd').val('');
                $('#pwd').css('color', 'black');
            }
        }
    
        function textboxtype() {
            if ($('#pwd').val().length < 1) {
                $('#pwd').val('Enter Your Password Here');
                $('#pwd').css('color', 'gray');
            }
        }
    

    In body:

    
    

提交回复
热议问题