$(document).on('pageshow','#temperatureContents',function(){
$(document).off('click','#convertbtnTemp').on('click','#convertbtnTemp',function(){
textFieldValue = $('#numberField').val();
});
});
if(selectFrom == "celcius" && selectTo == "kelvin"){
celToKel(selectFrom,selectTo,textFieldValue);
}
function celToKel(selectFrom,selectTo,textFieldValue){
var value = Number(textFieldValue).toFixed(1);
var result = (value + 273.15);
displayResult(selectFrom,selectTo,result);
}
function displayResult(selectFrom,selectTo,result){
$('#resultDiv').show();
$('#resultDisplay').empty().append("the Result of " + selectFrom + " to " + selectTo + " is: " + result);
}
问题在于这两行它给了我1 + 273.15 = 1.0273.15 但我想在 273.15 中添加 1 我怎样才能得到这个?
var value = Number(textFieldValue).toFixed(1);
var result = (value + 273.15);