Calculate Percentages from Two HTML inputs with javascript

March 1st, 2013 by admin Leave a reply »

I recently had a need for a generic way to calculate 100% across two input boxes, for instance if you entered 50% in one box it would go over and put 50% in the other, and vice-versa.  Well, I have accomplished this with a little help from jQuery and for formatting I use the excellent javascript library called autoNumeric found HERE.  Make sure you use the one I have referenced here in the fiddle as others would not let the autoNumericGet work, it must have been older versions. I have linked my jsFiddle below, check it out, run the sample and see how it works, hope this helps someone.

If you can’t see, the fiddle, here is a link to it:
http://jsfiddle.net/eddie_d_2000/H92FC/

Advertisement

Leave a Reply