I have the following code:
$("#negativecustomnicotinevgInput,
#positivecustomnicotinevgInput").click(function(){
if($(this).attr("id") == "negativecustomnicotinevgInput"){
$("#customnicotinepgInput").val($("#customnicotinepgInput").val()+5);
}
else if($(this).attr("id") == "positivecustomnicotinevgInput"){
$("#customnicotinepgInput").val($("#customnicotinepgInput").val()-5);
}
});
When I click on the button positivecustomnicotinevgInput
this reduces the value by 5. However, when clicking on negativecustomnicotinevgInput
this actually concatenates the number 5 rather than adding it to the value.
For example, the value 50 becomes 505 then 5055 rather than the expected 55 and 60 by adding 5.