Hi i have this javascript function
function test(){
var count = 0;
var date1 = $('#alternatestartdate').val();
var date2 = $('#alternateenddate').val();
var startDate = new Date(date1);
var endDate = new Date(date2);
var loop = true;
while (loop)
{
$('#pa').append('first test');
if (startDate<=endDate)
{
$('#pa').append('second test');
loop = true;
}
startDate.setDate(startDate.getDate()+1);
}
else
{
loop = false;
}
}
}
The problem is the function will not enter the if loop when tested in IE8. So only first test will be printed. second test will not be printed. Other browser all work fine. How to fix this?