Get the App
SLTechnology News&Howtos  ›  Development  › 

How does jQuery realize the function of password strength prompt when registering a member?

Shulou Source: shulou.com Published: 2022-06-01 02:20:41 10月03日 Update

Most people do not understand the knowledge points of this article "jQuery how to achieve password strength prompt information function when registered members", so the editor summarizes the following content to you, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "jQuery how to achieve password strength prompt information function when registered members" article.

1. The effect is shown in the figure:

2.html Code:

Set password: *

Password strength

3.jquery Code:

/ / checkStrong function / / returns the strength level of the password function checkStrong (sPW) {if (sPW.length=1;} return modes;} / / pwStrength function / / when the user releases the keyboard or the password input box loses focus, different colors are displayed according to different levels: function pwStrength (pwd) {var colors = "# eeeeee"; var colors = "# FF4040"; var colors = "# FF9900"; var colors = "# 33CC00"; var info = "" If (pwd==null | | pwd=='') {Lcolor=Mcolor=Hcolor=O_color;} else {S_level=checkStrong (pwd); / / detect password strength switch (S_level) {case 0: Lcolor=L_color; Mcolor=Hcolor=O_color; info = "weak"; break; case 1: Lcolor=L_color; Mcolor=Hcolor=O_color; info = "weak"; break Case 2: Lcolor=Mcolor=M_color; Hcolor=O_color; info = "medium"; break; default: Lcolor=Mcolor=Hcolor=H_color; info = "strong";}} $("# strength_L"). Css ("background", Lcolor); $("# strength_M"). Css ("background", Mcolor); $("# strength_H"). Css ("background", Hcolor) $("# pw_check_info") .html (info); / / password strength hint information return;} above is about "how to realize the password strength prompt function when registering members in jQuery". I believe you all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Tags: Password strength content information hint member function registered member function different code article knowledge article level special value most character lowercase Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Redmi Apple MySQL Xiaomi