jQuery change totals when many form textboxes are changed

I have about 25 textboxes where users enter how many of each component they want, and the text box which holds the total should change on the fly.   Is there a way to check ALL of the textboxes for changes as they happen instead of writing out each one?
This is here:
http://www.cloudconnect.net/pricing-estimate
I thought this was working, but it is not, so I can't get to work either. It works in Firebug though, so I don't understand why it doesn't work on the page

function recalculateTotal() {
    var count = $('#edit-submitted-users-desktop-users').val();
    count = parseFloat( count );
    $('#edit-submitted-users-total-users-price').val( count * p1 );
}
var fieldCount = $('#edit-submitted-users-desktop-users');
fieldCount.change( recalculateTotal );
LVL 17
nanharbisonAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Michel PlungjanConnect With a Mentor IT ExpertCommented:
So the selector could be

$("input[name|='submitted[users]']")

http://api.jquery.com/attribute-contains-prefix-selector/
0
 
Michel PlungjanIT ExpertCommented:
You need unique IDs

Why not use class or name?
0
 
nanharbisonAuthor Commented:
Each textbox has a unique ID. How do I use a class or name?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Michel PlungjanIT ExpertCommented:
Not on the page I looked at. There were at least two fields with the same ID and your code here obviously try to get at more than one field using one ID

Please have a look here

http://api.jquery.com/attribute-starts-with-selector/
0
 
nanharbisonAuthor Commented:
I have set up the form with with field sets, so those are the same for groups of textboxes, but the input textboxes are all different.
0
 
Michel PlungjanIT ExpertCommented:
You need UNIQUE ids for all elements on a page
0
 
nanharbisonAuthor Commented:
Ugh, this is a Drupal site, and the module created these non-unique IDs, and I have no control over that. Is this why the javascript isn't working? it works perfectly when I run it in Firebug.
0
 
Michel PlungjanIT ExpertCommented:
How come you have no control? Can't you edit the Drupal templates?
And what do you mean "it works in firebug" I used firebug to see you did not have unique ids
0
 
nanharbisonAuthor Commented:
Where do you look in firebug to see there are IDs that are not unique?
0
 
Michel PlungjanIT ExpertCommented:
Apologies. Perhaps I saw

edit-submitted-users-desktop-users-wrapper
and
edit-submitted-users-desktop-users
0
 
nanharbisonAuthor Commented:
I did the code for this question on my own, by brute force. It isn't elegant at all, but it works. But I appreciate the time mplungjan put in to look at what I was doing.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.