# Updating calculation field(s) on jQuery action/trigger

**URL:** <https://community.gravityforms.com/t/updating-calculation-field-s-on-jquery-action-trigger/7074>\
**Category:** Get Help\
**Tags:** custom, calculations, jquery, has-ticket\
**Created:** [December 3, 2020, 3:02pm UTC](https://community.gravityforms.com/t/updating-calculation-field-s-on-jquery-action-trigger/7074 "2020-12-03T15:02:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dave.o](https://avatars.discourse-cdn.com/v4/letter/d/85f322/32.png) [@dave.o](https://community.gravityforms.com/u/dave.o)\
**Post date:** [December 3, 2020, 3:02pm UTC](https://community.gravityforms.com/t/updating-calculation-field-s-on-jquery-action-trigger/7074/1 "2020-12-03T15:02:00Z")

</div>

Hi there,

I’m using a couple of number fields where I have added a PLUS and MINUS button to the right for a better user experience.

These fields are used to calculate a price later on in the field. This all works, however when a user presses + or - instead of manually typing a new number the calculation doesnt trigger. It does successfully confirm the entry after submitting it.

Is there a way to trigger the calculations every time the button is pressed?

I’m using the following jQuery to add the buttons:

```
	$(function() {
	    $(".plusmin .ginput_container_number").append('<div class="dec plusminbutton">-</div><div class="inc plusminbutton">+</div>');
	});

	setTimeout(
		function() {
			$(".plusminbutton").on("click", function() {
			var $button = $(this);
			var oldValue = $button.parent().find("input").val();

			if ($button.text() == "+") {
				var newVal = parseFloat(oldValue) + 1; 	
			} else {
			// Don't allow decrementing below zero
			if (oldValue > 0) {
			  var newVal = parseFloat(oldValue) - 1;
			} else {
			  newVal = 0;
			}
		}
			$button.parent().find("input").val(newVal);
		});
	}, 100);

```

I’ve tried using this: [https://docs.gravityforms.com/gform\_post\_calculation\_events/](https://docs.gravityforms.com/gform_post_calculation_events/) - but I don’t understand how to apply that to the correct form/field-ID('s).

Thanks in advance.

Best,  
Dave

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [January 4, 2022, 5:48pm UTC](https://community.gravityforms.com/t/updating-calculation-field-s-on-jquery-action-trigger/7074/2 "2022-01-04T17:48:42Z")

</div>


