JQuery Client-Side Calculations
In this article I’ll guide you how to perform client side calculations using JQuery. JQuery is a very powerful tool for client side validations, calculations, animations etc.
You might have come across situations where you need to perform calculations based on one input to several others. One good example would be, assume you are supposed to offer discounts to your online clients. In a situation like this you may need to update both Discount Value and Net value based on the discount percentage and Amount. This can be achieved without going to the server or without using a scripting language like PHP or ASP.NET.
Let’s look at the Jquery Example more closely. It demonstrates a typical scenario we encounter in day to day web programming. Prerequisites are Jquery library as a reference on the top of your page. You can download Jquery library from here.
Lastly you need to rebind the processed values into html controls. This you can perform using the Jquery method arrr(). It accepts two parameters. One is the attribute name and the other attribute value. As you can see in the above code i have used the attr() to bind back the values to html controls.