radio button selected then insert using if statement
Dear Team,
I am facing problem in JavaScript, i have two radio button option called "Days" and "Hours".
when we press the Days it should use this formula for calculate the Days
---------------------
$('input[name="from_date"], input[name="to_Date"]').change( function(){
d1 = $('input[name="from_date"]').datepicker('getDate');
d2 = $('input[name="to_Date"]').datepicker('getDate');
diff = 0;
if (d1 && d2)
{
diff = Math.floor((d2.getTime() - d1.getTime()) / 86400000)+1; // ms per day
}
$('input[name=Enter_Number_of_Days_Hours]').val(diff);
});
------------------------------------
and when we click on the Hours i want to clear the text from this ID "Enter_Number_of_Days_Hours" so that the user can enter the number of hours .
can you please help me with JavaScript for this. as i have tried all the place could not find the suitable solution for joget