Skip to content
Advertisement

Calculate percentage Javascript

I have a question about javascript logic what I use to get percent of two inputs from my text fields. Here is my code:

JavaScript

For some reason if my inputs are 600 and 200, my result suppose to be 33.333 but I’m getting 3.333. If I hard code my values this works fine. If anyone can help I appreciate that.

Advertisement

Answer

It seems working :

HTML :

JavaScript

JavaScript :

JavaScript

Demo : http://jsfiddle.net/vikashvverma/1khs8sj7/1/

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement