Click here to Skip to main content
15,991,026 members
Home / Discussions / JavaScript
   

JavaScript

 
Questionjavascript Pin
Sumia Rafique7-Aug-24 19:38
Sumia Rafique7-Aug-24 19:38 
AnswerRe: javascript Pin
Andre Oosthuizen10-Aug-24 4:45
mveAndre Oosthuizen10-Aug-24 4:45 
AnswerRe: javascript Pin
MrSuddenJoy14-Aug-24 8:56
MrSuddenJoy14-Aug-24 8:56 
GeneralRe: javascript Pin
Richard Deeming14-Aug-24 17:49
mveRichard Deeming14-Aug-24 17:49 
GeneralRe: javascript Pin
MrSuddenJoy15-Aug-24 1:03
MrSuddenJoy15-Aug-24 1:03 
GeneralRe: javascript Pin
Richard Deeming15-Aug-24 1:26
mveRichard Deeming15-Aug-24 1:26 
GeneralRe: javascript Pin
MrSuddenJoy15-Aug-24 2:46
MrSuddenJoy15-Aug-24 2:46 
QuestiontoLocaleString() works to insert commas in a asp.net textbox until I enter the eighth digit. The eight digit breaks the insertion of commas Pin
fig00006-Jul-24 12:10
fig00006-Jul-24 12:10 
Hi,
I am not the best at Javascript but have been using it more to avoid web forms postbacks at my users requests. The user also requested commas inserted in an numeric field (no decimal digits) as they type. I used toLocaleString(). The insertion of commas works fine until I get to the eighth digit. At that point the number shrinks in size and goes back to four digits, There is a valid comma in this but obviously I need to be able to put in more than 7 digitis.
Here is the seven digit state of the field:
1,234,567
And here is the field when I add the number 8 to the end of the above number:
1,234

The following code fired from on the onkeyup event handles this number:

var word = txtbox.value;
word = word.replace(“,”, “”);
let num = word;
formatted = parseInt(String(num)).toLocaleString();
txtbox.value = formatted;

I have also tried functions i found on web posts and regex values. Some cases didnt work at atll but many of the cases involving regex also seemed to break once the eighth digit is entered. Oddly all the examples I’ve seen on the web seem to involve no more than seven digits.
I tried adding “en-us” to the toLocaleString() as well as setting maxiumnsignificantdigits to 9. The result was the same.
8 seems to be a magic number and the solution is probably buried in some obscure documentation somewhere.
Any help would be appreciated.

Neil
AnswerRe: toLocaleString() works to insert commas in a asp.net textbox until I enter the eighth digit. The eight digit breaks the insertion of commas Pin
Richard Deeming7-Jul-24 21:17
mveRichard Deeming7-Jul-24 21:17 
GeneralRe: toLocaleString() works to insert commas in a asp.net textbox until I enter the eighth digit. The eight digit breaks the insertion of commas Pin
fig00008-Jul-24 4:25
fig00008-Jul-24 4:25 
GeneralRe: toLocaleString() works to insert commas in a asp.net textbox until I enter the eighth digit. The eight digit breaks the insertion of commas Pin
Richard Deeming8-Jul-24 6:43
mveRichard Deeming8-Jul-24 6:43 
GeneralRe: toLocaleString() works to insert commas in a asp.net textbox until I enter the eighth digit. The eight digit breaks the insertion of commas Pin
fig00009-Jul-24 4:42
fig00009-Jul-24 4:42 
GeneralRe: toLocaleString() works to insert commas in a asp.net textbox until I enter the eighth digit. The eight digit breaks the insertion of commas Pin
Richard Deeming9-Jul-24 5:44
mveRichard Deeming9-Jul-24 5:44 
GeneralRe: toLocaleString() works to insert commas in a asp.net textbox until I enter the eighth digit. The eight digit breaks the insertion of commas Pin
Jeremy Falcon17-Jul-24 16:13
professionalJeremy Falcon17-Jul-24 16:13 
GeneralRe: toLocaleString() works to insert commas in a asp.net textbox until I enter the eighth digit. The eight digit breaks the insertion of commas Pin
jsc428-Jul-24 22:49
professionaljsc428-Jul-24 22:49 
GeneralRe: toLocaleString() works to insert commas in a asp.net textbox until I enter the eighth digit. The eight digit breaks the insertion of commas Pin
fig00009-Jul-24 4:32
fig00009-Jul-24 4:32 
GeneralRe: toLocaleString() works to insert commas in a asp.net textbox until I enter the eighth digit. The eight digit breaks the insertion of commas Pin
jschell18-Jul-24 14:32
jschell18-Jul-24 14:32 
GeneralRe: toLocaleString() works to insert commas in a asp.net textbox until I enter the eighth digit. The eight digit breaks the insertion of commas Pin
fig000018-Jul-24 20:02
fig000018-Jul-24 20:02 
QuestionCan we use the NuGet package of .Net in WebDriverIO (JavaScript) framework? Pin
Anand Sabley20-Jun-24 20:44
Anand Sabley20-Jun-24 20:44 
QuestionProgressbar has a value of 100% before upload progress is finished Pin
Red Kipling4-Jun-24 9:34
Red Kipling4-Jun-24 9:34 
AnswerRe: Progressbar has a value of 100% before upload progress is finished Pin
Richard Andrew x648-Jun-24 11:33
professionalRichard Andrew x648-Jun-24 11:33 
GeneralRe: Progressbar has a value of 100% before upload progress is finished Pin
Richard Deeming9-Jun-24 21:39
mveRichard Deeming9-Jun-24 21:39 
AnswerRe: Progressbar has a value of 100% before upload progress is finished Pin
jschell12-Jun-24 15:04
jschell12-Jun-24 15:04 
AnswerRe: Progressbar has a value of 100% before upload progress is finished Pin
Steve Raw17-Jun-24 10:34
professionalSteve Raw17-Jun-24 10:34 
QuestionProgressbar get only the size of first input Pin
Red Kipling2-Jun-24 0:43
Red Kipling2-Jun-24 0:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.