How to determine the number of digits entered by the user?

question: how to determine the number of digits entered by the user, and alert out
condition: assume that the user can only enter numbers. Type is number
for example: user typed 1234, click submit and alert out 4;
user entered 456454579988, click submit after alert comes out is 12;
above is my request to get out with JS, because I am a beginner, did not come into contact with regular expressions, please do not use regular, because do not understand!

Aug.18,2021

this has to be tested. What you enter may be a combination of numbers, letters, underscores, special symbols, etc., but all you have to do is write a for loop, regular matching in the loop body, and you have to check out the numbers and count them.


I am a rookie, please spray
1. First of all, determine whether it is a number
2. If it's just a simple integer, the number you enter

var num = ;
alert(num.toString().length);

3. If there is a decimal point (I don't know if this is correct)

var num = 
alert(num.toString().split(".")[0].length)

read more documents

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaef3d-221d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaef3d-221d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?