Hi,
I'm trying to update my fields once I perform changing values from other fields.
please see my fields.
textfield1 = 100 <--____VALUES---
textfield2 = 100 <--____VALUES---
textfieldTotal = 200 <--___ Total ( Need to change this fields every time i perform simple addition to my textfield1 and textfield2.
Any good tutorial? I know it can be done in Jquery.
thank you.
Update fields Jquery
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Update fields Jquery
Register the change event for textfield1 and textfield2. In the function you register update the value of textfieldTotal from the values of textfield1 and textfield2.
There are docs and examples here: http://api.jquery.com/change/
There are docs and examples here: http://api.jquery.com/change/
(#10850)
Re: Update fields Jquery
When you do make some headway, post your code here, because people new to jQuery rarely use it as efficiently as they could be, we might be able to give you some further pointers.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: Update fields Jquery
Hi,
Can somebody help me to solve this problem?
I have form, form contains these fields.
Principal - textfield1
Interest - textfield2
Service Charge - textfield3
and Total. - textfield4
scenario is this.
I will input an amount of (2000.00) in Principal(textfield1) , automatically the Total(textfield4) will change from 0.00 to 2000.00, and when I input 12 in Interest(textfield2) the total will update again to 2240.00 same with service charge. if i input 100 in service charge(textfield3) it will total to 2340.00.
All best.
Can somebody help me to solve this problem?
I have form, form contains these fields.
Principal - textfield1
Interest - textfield2
Service Charge - textfield3
and Total. - textfield4
scenario is this.
I will input an amount of (2000.00) in Principal(textfield1) , automatically the Total(textfield4) will change from 0.00 to 2000.00, and when I input 12 in Interest(textfield2) the total will update again to 2240.00 same with service charge. if i input 100 in service charge(textfield3) it will total to 2340.00.
All best.
Re: Update fields Jquery
You've been given help already. Scroll up. So what progress have you made so far?
Re: Update fields Jquery
Here's,
but I want the text total to automatically change everytime i change the value in textfields without going to other field.
thanks,
s.dot| - Moderator Edit - Please use the formatting tags when posting code.
but I want the text total to automatically change everytime i change the value in textfields without going to other field.
Code: Select all
$(document.body).on('change', 'input[name]', function() {
var form = document.forms['calculator'],
prin = parseFloat(form.principal.value),
intr = parseFloat(1 + form.interest.value),
serv = parseFloat(form.service.value);
$('[name=total]').val(prin * intr + serv);
});
$(function () {
// manually trigger the change event to display
// the total using the default values
$(document.forms['calculator'].principal).change();
})s.dot| - Moderator Edit - Please use the formatting tags when posting code.
Update fields Jquery
The input element has lost focus jquery input field change even when value is changed via jquery . when jQuery itself tries to change the elements but not when the elements gets changed from outside jQuery .