okay i have a mystery here that i can't seem to find the solution for. And can't seem to find any documentation backing it up or giving me a solution.
but i have a lot of divs with some infomation stored in the data attribute. like so:
<div data-name="valA"></div>
<div data-name="valB></div>
and im getting the stored infomation with this function
function finishFood(that) {
var food_ammount = parseFloat(jQuery('.foodinfo-form #food_ammount').val().replace(",", "."));
console.log(food_ammount);
var food_name = jQuery('.foodinfo-form .food_name').data('name');
console.log(food_name);
}
and it works great the first time. But next time the function is called it returns the old the value?
i have even tried defining the variables first as empty and tried null the variables after use nothing is working. Every time i call the function the first value is returned. the food_ammount is working and is returning the correct updated value.