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.
Easy Related Posts
JQuery - bind events to Dynamically created HTML elements
In JQuery you can create html elements dynamically at any given time. But have you noticed, those ...read more
Using Google maps display address locations
In this article I will guide you how to show an address location on the ...read more
load Razor view into modal dialog in ASP.NET MVC3
In this tutorial we are going to find out how to load a ASP.NET MVC3 ...read more
Add Jquery modal dialogs to ASP.NET MVC Views
Setup ASP.NET MVC environment Let's find out how to add JQuery popup dialog box to ASP.NET ...read more