I have the following script. When I initially wrote it, it worked perfectly. Then I loaded the page over and it has broken and permanently is returning NaN
. I am able to run it successfully in the console but for some reason it will not work properly on the site. It is operating inside of a rails application.
$(document).ready(function(){
$('select').click(function(){
var often = parseInt($('#biohaz_frequency_often').val());
var time = parseInt($('#biohaz_frequency_time').val());
var timeoften = often * time
if(timeoften == 0){
var freq = 0;
}
else if(timeoften <= 2){
var freq = 1;
}
else if(timeoften <= 4){
var freq = 3;
}
else if(timeoften <= 9){
var freq = 6;
}
else if(timeoften > 9){
var freq = 10;
}
var sever = parseInt($('#biohaz_risk_severity').val());
var master = parseInt($('#biohaz_risk_mastery').val());
$('#risk_frequency').html(freq);
$('#risk_total').html(freq * sever * master);
})
})