I was designing an application to calculate cuf of solar panel on Hourly, Daily, Monthly and yearly basis…
I’ve created dropdown menu so that user can select one of the above mentioned option.
If user selects hourly then I need to populate 2 [input type=“Date”] fields with [yyyy-mm-dd hh] format
If user selects daily then I need to populate [input type=“Date”] with [yyyy-mm-dd] format
var select=document.getElementById('select');
var wrappElement=document.getElementById('wrapper');
select.addEventListener('change',function(){
if(select.value=='a'){
var dateElement=document.createElement('input');
dateElement.type='date';
wrappElement.appendChild(dateElement);
var dateElement=document.createElement('input');
dateElement.type='date';
wrappElement.appendChild(dateElement);
}
});