日本語コミュニティーへようこそ!このチャンネルは現在ベータ版です。

詳細はこちらをご覧ください。

Javascript "NaN" statistics

解決
トップ投稿者

Hi all スマイリー ハッピー

 

I'm working on this page. There is a blue banner above the 'Other opportunities' section that displays stats. In the page editor the stats display correctly (please see image below). I have updated this page a number of times but the first three stats don't display, showing "NaN" instead.

 

delete.PNGPage editor view

 

Any advise on this would be greatly appreciated.

 

Many thanks,

Jamila

返信
0 いいね!
承認済みベストアンサー

受理された解決策
アドバイザー

@JlawalGreat to hear!

 

You can updae the number using jQuery.

With that said there are a hundreds of jQuery solutions.

 

Here are some ideas to look into.

1) Updating the script that modifies the DOM element(displayed number) itself. Rather than "printing" the number it could print a string thst would include the commas. This would probably best replicate the animation you have currently.

 

2) Update the DOM element aftert the animation.

4件の返信4
アドバイザー

Hey @Jlawal Interesting issue here!

 

NaN for the non-js user means "not a number".

So Somewhere between the editor and something is interfearing with the script.

 

Now this is just a guess, but if you enter the final numbers 20,012 or 75,085,670 into the editor without the commas does that change anything?

My thought here is that maybe there is an error when parsing the author input.

トップ投稿者

Hi @Kevin-C , thank you for your help!

 

I've removed the commas and the nan has disappeared. You were right! Do you know if there is anyway to add the commas back in in a way that doesn't affect anything? It looks a bit odd without the commas スマイリー とてもハッピー

返信
0 いいね!
アドバイザー

@JlawalGreat to hear!

 

You can updae the number using jQuery.

With that said there are a hundreds of jQuery solutions.

 

Here are some ideas to look into.

1) Updating the script that modifies the DOM element(displayed number) itself. Rather than "printing" the number it could print a string thst would include the commas. This would probably best replicate the animation you have currently.

 

2) Update the DOM element aftert the animation.

Highlighted
トップ投稿者

Thank you for your help with this @Kevin-C . That has worked perfectly! とってもうれしいネコ