[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Fix Code written by another ee expert

Posted on 2014-07-11
6
Medium Priority
?
152 Views
Last Modified: 2014-07-11
had another expert write this code>The textbox only allows numbers, but when the textbox looses focus
a period and zero are added to the end of the input numbers eg (4500) when loosing focus(4500.0)
What is wrong ?
http://jsbin.com/nukit/6/edit
0
Comment
Question by:isnoend2001
  • 3
  • 2
6 Comments
 
LVL 36

Expert Comment

by:ste5an
ID: 40191163
Nothing. This is called formatting of numbers..
0
 

Author Comment

by:isnoend2001
ID: 40191172
using Chrome non-numeric entries are alowed and no calculations are done
0
 

Author Comment

by:isnoend2001
ID: 40191178
Thanks ste5an
How can it be changed  where the . and zero are not entered ?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:Nathan Riley
ID: 40191428
In your javascript:

         var inVal = parseFloat($('#in').val());   // CONVERT THE VALUE OF THE TEXT BOX TO A FLOAT NUMBER
         inVal = inVal.toFixed(1); // USE ONLY ONE DECIMAL PLACE FOR THE  VALUE

Open in new window


change that to:

var inVal = parseFloat($('#in').val());   // CONVERT THE VALUE OF THE TEXT BOX TO A FLOAT NUMBER
         inVal = inVal.toFixed(0); // USE ONLY ONE DECIMAL PLACE FOR THE  VALUE

Open in new window

0
 
LVL 12

Accepted Solution

by:
Nathan Riley earned 2000 total points
ID: 40191431
0
 

Author Closing Comment

by:isnoend2001
ID: 40191454
Thanks that fixes the issue
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

DOM Attributes and Properties treatment with jQuery 1.6 by Ivo Stoykov jQuery (http://jquery.com/) 1.6 introduces .prop() (http://api.jquery.com/prop/) and .removeProp() (http://api.jquery.com/removeProp/) methods which allow modifying or removi…
PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question