Minor correction to code

On this page:
http://roofgenius.com/test6.asp
when entering numbers into the textbox and then clicking anywhere on the screen
a period and 0 are added to the end of the numbers entered (.0)
example enter 2545 the number changes to 2545.0
How can this be corrected ?
isnoend2001Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy PooleCommented:
     $('#in').change(function () {  // DETECT CHANGE IN THE TEXT FIELD
        
         roofAreaVal = $('#selectPitch option:selected').val(); // GET THE VALUE OF THE SELECT MENU
         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
         inVal=inVal==Int(inVal)?Int(inVal):inVal;
         $('#in').val(inVal); // SEND THE NEW NUMBER BACK TO THE FIELD TO VISUALLY SHOW THE CONVERSION
         if (!$.isNumeric(inVal)) { // DETECT IF OUR NUMBER IS NUMERIC

             clearFields(); // IF NOT NUMERIC, RUN THE CLEAR FIELDS FUNCTION (SET EVERYTHING TO BLANK)
             alert('Please enter a valid number'); //ALSO SEND AN ALERT
         } else {
             if (inVal <= 0) {  //IF IT IS NUMERIC, CHECK THAT THE NUMBER IS GREATER THAN 0

                 clearFields();  // IF NOT, CLEAR THE FIELDS 
                 alert('Please enter a positive number greater than zero');  // AND SEND THE ALERT
             } else {

                 calc(roofAreaVal);  // WE HAVE A GOOD VALUE, RUN THE FUNCTION TO MAKE THE CALCULATIONS 
             }
         }
     });

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
isnoend2001Author Commented:
Thanks works perfect
0
isnoend2001Author Commented:
I had another EE coder write more code and now  the same problem has returned
i copied and pasted your code, but cannot determine where you made changes.
Can you tell me where you made corrections ?
http://roofgenius.com/test3.asp
0
Randy PooleCommented:
inVal=inVal==Int(inVal)?Int(inVal):inVal;
0
isnoend2001Author Commented:
Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.