Javascript Addition Problem

How to solve the problem ???



var bidincrement1= document.getElementById('bidincrement').value;
var item_bid_amount2=document.getElementById('item_bid_amount').value;
var bidincrement2=bidincrement1  +  item_bid_amount2;


if
bidincrement1=52
item_bid_amount2=45

I get 5245

The form values are strings, which is why they are being concatenated together.
Make them numbers and things will go better for you. You can also use a default value of 0 if the value cannot be properly converted in to a number.

For example:


bidincrement1 = Number(bidincrement1) || 0;