This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I have multiple price and quantity fields and their total ( price * quantity) in a loop with same form name and I want to calculate the total in each row with onChange event. Since they have same name how do I identify the exact fields. Please see example and give me a hint on how I can grab the exact changed field to calculate the corresponding total. The grand total field is outside the loop and would be the sum of all totals
for (i=0; i<5; i++)
<input type="text" name = "price"> <input type="text" name = "quantity"> <input type="text" name = "total">
Well, you'd need to traverse the siblings to find the one you want. Or, again, use id values and then you can leverage document.getElementById() to directly access the elements.
P.S. Also, scriptlets in your JSP? in 2009?
Joined: Nov 19, 2008
I appreciate your help, but I haven't gotten an answer to my question. I don't have the luxury of time to learn another library. First of all, you seem to be prone to code style. Can you tell me a true MVC architecture where the V NEVER includes some type of logic? the answer is NO. Now just because it is 2009 doesn't mean all application were born same year. There are many of us who are maintaining older systems with extreme deadlines.