score:0
The result put into #to_condition when the function updatecondition is called depends on both the newcondition parameter sent to the function and the #condition_exact value, and the latter is updated every time the updateconditino is called. Perhaps that update of the #condition_exact value is what is causing your problem?
$("#condition_exact").val(changecondition);
score:0
I think your problem is here:
updatecondition(bent_num * bent_orig * -1);
updatecondition(bent_num * bent_new);
You basically update the #condition_exact
field twice; once with a value based on bent_num
, and once with a value based on the user's input (bent_new
). The second update is (of course) the one you will see. I think what you meant to do was this:
updatecondition(bent_orig - (bent_num * bent_new));
Now the field will be updated only once. The new value will be the original value, minus the user's input times bent_num
.
By the way, your variable names are a bit confusing. For example, what does bent_num
mean? Is it the step size? Would someone else who looks at this code know what it means? (I certainly don't.) Will you, if you look at the code again in 6 months' time? So if bent_num
is the step size, why not call it step_size
(or stepSize
)?
score:1
James, I think you didn't paste you whole code, e.g. definition of bent_times is missing. However it clearly seems for me that the first two lines of updatecondition are the cause of your problem. You should always substract from $("#is_bent_num").val() isntead of $("#condition_exact").val()
Related Query
- Live table edit and update using ajax problem
- jQuery live edit table do ajax update and delete, focusout problem
- How to display the live online user in the system using CodeIgniter?
- How to update user email field in firebase using web?
- Using jQuery to update price based on menu drop down selections
- Unable to trigger the code-behind (aspx.cs) method from aspx page using update panel
- Using RGraph to poll data from a Postgres DB and update using AJAX/JSON
- how to swap two table cell value and update into database using ajax
- Update css using jQuery
- HighMaps how to update data using jQuery
- update shopping cart using ajax and laravel
- How to partially update the DOM using jQuery
- Rails- Using check box to update database without submit button
- How to update database using arrays?
- jQuery live update buttons text value
- Update item Firebase using jQuery
- Update text on button using JavaScript
- double live search using ajax
- How to update a data from a table using data-atributes in jQUery
- how to update multiple image that will store in different table using single action in yii2
- Using Knockout to update the view from JSON via click event
- want to update dropdown in each row in the database using Ajax
- Update inbox after submitting a reply, using jQuery and AJAX
- jquery multiselect keep the value from previous onChange events doesn't update using AJAX
- Update a query value using javascript/php
- How to update only specific page's Likes count using SignalR in MVC
- Update variable using $.ajax on .click
- Update data of existing Highstock graph using only JavaScript
- Best practice to update values in the table using AngularJS
- Using bootstrap-datetimepicker, specifically time, update values of multiple inputs on change?
- Calling a Function in PHP file, using AJAX, with an ID specific to a record in Database to update record
- Mysql UPDATE using PHP and AJAX, can't update database
- ASP.NET MVC | HOW to update specific column through EF using Ajax
- Update data using AJAX and codeigniter failed
- How to update sql table using edit fields?
- Update Rails Variable in ERB using Ajax
- Update MySQL using AJAX and PHP
- Yii2: Calculation using JQuery based on condition
- Update a href ID using Ajax
- PHP - Live Search using multiple MySQL tables
- Update a record within a list using ajax, Rails, Coffeescript, jQuery
- Live Update data-mask attribute for correct data masking
- Update page with Jquery using entity from doctrine2
- Partial View Update using Ajax refreshing the whole page
- How to update data using real-time (SignalR)
- Update multiple background-position on scroll using jQuery?
- .html() not working for live update of html table after jquery $.post
- Mysql table instant update using Jquery/Ajax without submission
- How to delete HTML row using jQuery and then update to database?
- Using textareas to display live results in iframe, using jQuery, add separate textarea input into iframes head
More Query from same tag
- How do I pull the selected values from a select tag in HTML?
- Disable required attribute on one radio button
- Set div with text to start where another div that is positioned center starts
- Set margin-left buffer on both sides of jquery slider
- Changing The BG Image on Scroll
- Ajax call not sending any data when added image data using django ajax
- jQuery Parallax Image Not Smooth When Scrolling With Mousewheel
- jQuery use td value as src for img
- Jquery loses brackets on data after ajax request
- Ajax/Jquery request is not sending cookies
- Cannot get Ajax update form to work with unserialize
- Not able to fix width of datatable columns
- Get post array in dynamic input area jquery to insert batch codeigniter
- on change submit form does not pass the changed value with the form
- Use the same gform twice on the same page
- Looping through inner jquery accordion fields
- TinyMCE and Yii
- Animating content loaded with Ajax
- Background color for one line in tinymce
- Wrap group of elements in multiple HTML elements using JQuery
- Window is supposed to close on click, instead closes immediately
- Need help calling a function
- Simple sticky menu issue
- jQuery - Slider to pull steps from custom "data-steps" attribute
- Knockout.js: Get options text from select populated with ajax call
- Make menu flags slide in a fixed menu while I scroll up & down a page
- Uncaught TypeError: $.get(...).then is not a function
- How to generate a Div to fill a row?
- Setting New Dimension using Jquery or Javascript for CylinderGeometry from Three.js
- Date Time Jquery datetimepicker