/    Sign up×
Community /Pin to ProfileBookmark

set value to 3.20 becomes 3.2 ???

Hi,

I’m trying to set the value of a checkbox to 3.20 but but JS takes off the last zero which I need.

i.e. 3.20 becomes 3.2

How can I avoid that?

thanks all…

jp

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@VladdyMar 10.2004 — JS does not take anything.

You are the one who does not specify how many digits you want, when converting number to string:

http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/number.html#1200964
Copy linkTweet thisAlerts:
@jpbertraauthorMar 10.2004 — hi again Vladdy.

never mind...

I found a solution to my problem...

since the first digit before the dot is my level and the number after the dot is my ID, I took off the dot and did a substr in perl to get value of first element and value of the rest...

Thanks anyway bud...
×

Success!

Help @jpbertra spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...