0

My html code is working in jsfiddle.. Below is the link : jsfiddle

But when tried to exceute in desktop im getting following error

Uncaught TypeError: Cannot read property 'addEventListener' of null at six.php:8 (anonymous) @ six.php:8

Html :

<html>
<title>capacity utilization factor</title>

<body>
  <form method="post">
    CUF PERFORMANCE
    <div id="wrapper">
      <select id="select" name="options">
            <option>Select The Value</option>
            <option id="hourly" value="a">Hourly</option>
            <option id="daily" value="b">Daily</option>
            <option id="monthly" value="c">Monthly</option>
            <option id="yearly" value="d">Yearly</option> 
             </select> /div>
  </form>
</body>

</html>

JS :

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 = 'dateTime';
    wrappElement.appendChild(dateElement);
    var dateElement = document.createElement('input');
    dateElement.type = 'dateTime';
    wrappElement.appendChild(dateElement);
  }
}, false);
R3tep
  • 11,061
  • 9
  • 38
  • 69
Pradeep
  • 255
  • 2
  • 14

0 Answers0