---
title: "sum input values and skip one of them jquery"  
description: "sum input values and skip one of them jquery"  
author: "Manoj Bhatt"  
published: 2013-05-18  
updated: 2013-05-18  
canonical: https://www.mindstick.com/forum/909/sum-input-values-and-skip-one-of-them-jquery  
category: "jquery"  
tags: ["jquery"]  
reading_time: 2 minutes  

---

# sum input values and skip one of them jquery

Hi!\
I have [form](https://www.mindstick.com/forum/6/multi-form-mfc-application) which is making sum of numbers but i want that middle [input](https://www.mindstick.com/forum/159209/how-can-i-read-convert-an-input-stream-into-a-string-in-java) to be skipped by jquery for summing... please help with this code here i posting... it surely \
[must](https://www.mindstick.com/articles/12978/top-reasons-why-every-magento-ecommerce-store-must-opt-for-mobile-app) be inupt tag because it sends [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science) to php. i spend so much time to [figure](https://yourviews.mindstick.com/view/87536/what-are-ghosts-jobs-and-how-to-figure-out-them) this out but i cant like you see.\
jQuery\
var total; $("input.amount").keyup([function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server)() { total = 0; $(this).parents("[table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap)").find("input.amount").each(function() { total += parseInt($(this).val()); }).end().find("span.total").[html](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript)(total); });HTML\
<form [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp)="calc"> Form 1 <br /> <table border="0"> <tr> <td> Amount 1 </td> <td> <input class="amount" type="text" /> </td> </tr> <tr> <td> Amount 2 </td> <td> <input class="amount" type="text" /> </td> </tr> <tr> <td> Amount 3 </td> <td> <input class="amount" type="text" /> </td> </tr> <tr> <td> Total Amount </td> <td> <span class="total">0</span> </td> </tr> </table> </form>\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

Hi Manoj!\
Simply change the HTML markup to give the input you wish to ignore a new class or data-* attribute.\
<input class="amount ignored" type="text" />Then check for the class in your .each() loop:\
if(!$(this).hasClass('ignored')) total += parseInt($(this).val());\
If you go down the data-* route, you could use:\
<input class="amount" type="text" data-ignored="true" />\
And check making sure that the data attribute is set:\
if(!$(this).data('ignored'))total += parseInt($(this).val());\
I hope it helpful for you.


---

Original Source: https://www.mindstick.com/forum/909/sum-input-values-and-skip-one-of-them-jquery

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
