Label for password field

前端 未结 7 1002
渐次进展
渐次进展 2021-01-03 04:24


I\'m using jQuery to make the inline labels

7条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-03 05:13

    My solution is close to what Dan provided above.

    
    

    An alternative here would be to omit the "label" parameter, and just use the "title" value, which is basically what labelify.js does. You could add in the part of labelify that just applies these event handlers to all inputs of type text if you wanted. Or download labelify and add the below code where needed:

                if (this.type == 'text' && label == 'Password') {
                    this.type = alttype;
                }
    
                if (this.type == 'text' && label == 'Password') {
                    this.type = alttype;
                }
    

    The only advantage my snippet has over labelify is that it includes the answer to your original question:

    I wonder if its possible somehow to show "Password" label as text (instead of ••••) inside the password field?

提交回复
热议问题