Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use regular JS to control users to enter bank card number and format

Shulou Source: shulou.com Published: 2022-06-02 05:19:22 10月02日 Update

This article is about how JS uses rules to control users to enter bank card numbers and formatting. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

/ / js regularization realizes the control and formatting of bank card number input by users.

Function formatBankNo (BankNo) {if (BankNo.value = "") return; var account = new String (BankNo.value); account = account.substring (0meme 22) / * Total number of accounts Including spaces * / if (account.match (". [0-9] {4}-[0-9] {4}-[0-9] {4}-[0-9] {7}") = null) {/ * contrast format * / if (account.match (". [0-9] {4}-[0-9] {4}-[0-9] {4}-[0-9] {7} |" + ") [0-9] {4}-[0-9] {4}-[0-9] {7} | "+". [0-9] {4}-[0-9] {4}-[0-9] {4}-[0-9] {7} | "+". [0-9] {4}-[0-9] {4}-[0-9] {7} " ) = = null) {var accountNumeric = accountChar = "" I For (iSuppli)

Tags: Spaces format account number card number regular user bank control input add good digit content more article practical total effect article read Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia macOS Huawei vpn MariaDB