title: Typescript error "Property 'value' does not exist on type 'HTMLElement'", "Property 'onclick' does not exist on type 'Element'"
body: <p>I am trying to put in a typescript file, then these &quot;Property 'value' does not exist on type 'HTMLElement'&quot;, &quot;Duplicate function implementation.&quot; and &quot;Property 'onclick' does not exist on type 'Element'&quot; appear on my screen as compilation error but when I tried to run in javascript file it works very well.
  <a href="https://jsfiddle.net/chrismontage/onh51g93/12/" rel="nofollow noreferrer">https://jsfiddle.net/chrismontage/onh51g93/12/</a></p>
  <pre><code>&lt;label for = &quot;password&quot;&gt;New Password&lt;/label&gt;
  &lt;input type=&quot;password&quot; class = &quot;input&quot; id = &quot;password1&quot; value=&quot;&quot;&gt;
  &lt;label for = &quot;cnfm-password&quot;&gt;Confirm Pasword&lt;/label&gt;
  &lt;input type=&quot;password&quot; class = &quot;input&quot; id = &quot;password2&quot;&gt;
  &lt;input onclick = &quot;verifyPassword()&quot; type=&quot;submit&quot; value = &quot;Save Changes&quot;class = &quot;btn&quot; id = &quot;myBtn&quot;&gt;
            
   &lt;!-- The Modal --&gt;
  &lt;div id=&quot;myModal&quot; class=&quot;modal&quot;&gt;
  
    &lt;!-- Modal content --&gt;
    &lt;div class=&quot;modal-content&quot;&gt;
      &lt;div class=&quot;modal-header&quot;&gt;
        &lt;img src=&quot;/images/logo.png&quot; alt=&quot;SAMPLE&quot; width=&quot;120&quot; class = &quot;mx-auto&quot;&gt;
        &lt;span class=&quot;close&quot;&gt;&amp;times;&lt;/span&gt;
      &lt;/div&gt;
      
      &lt;div class=&quot;modal-body&quot;&gt;
        &lt;h4 class = &quot;text-center&quot;&gt;&lt;span id = &quot;message1&quot;&gt;&lt;/span&gt;&lt;/h4&gt;
      &lt;/div&gt;
      &lt;div class=&quot;modal-footer mx-auto&quot;&gt;
        &lt;button class = &quot;btn&quot; id = &quot;confirm&quot;&gt;Okay&lt;/button&gt;
  
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>ts file</p>
  <pre><code>function verifyPassword(){
      var pw1 = document.getElementById(&quot;password1&quot;);
      var pw2 = document.getElementById(&quot;password2&quot;);
      
      // Get the modal
      var modal = document.getElementById(&quot;myModal&quot;);
      
      // Get the button that opens the modal
      var btn1 = document.getElementById(&quot;myBtn&quot;);
      
      var confirm = document.getElementById(&quot;confirm&quot;);
      
      // Get the &lt;span&gt; element that closes the modal
      var span = document.getElementsByClassName(&quot;close&quot;)[0];
      
      
      btn1.onclick = function () {
          
          modal.style.display = &quot;block&quot;;
      
          //check empty password field
      
          if(pw1.value == &quot;&quot;) {
              document.getElementById(&quot;message1&quot;).innerHTML = &quot;Please put your new password!&quot;;
              return false;
          }
      
          //minimum password length validation
          if(pw1.value.length &lt; 8) {
              document.getElementById(&quot;message1&quot;).innerHTML = &quot;Password length must be atleast 8 characters&quot;;
              return false;
          }
      
          //maximum length of password validation
          if(pw1.value.length &gt; 15) {
             document.getElementById(&quot;message1&quot;).innerHTML = &quot;Password length must not exceed 15 characters&quot;;
             return false;
          } else {
             if(pw1.value == pw2.value){
                 document.getElementById(&quot;message1&quot;).innerHTML=  &quot;Passwords match!&quot;;
             }
          
             else {
                 document.getElementById(&quot;message1&quot;).innerHTML=  &quot;Passwords not match!&quot;;
             }
          }
      
      }
      
      confirm.onclick = function () {
          modal.style.display = &quot;none&quot;;
      }
      
      // When the user clicks on &lt;span&gt; (x), close the modal
      span.onclick = function() {
          modal.style.display = &quot;none&quot;;
        }
      
        // When the user clicks anywhere outside of the modal, close it
      window.onclick = function(event) {
          if (event.target == modal) {
            modal.style.display = &quot;none&quot;;
      }
      }
  }
  </code></pre>
  <pre><code>/* The Modal (background) */
  .modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    padding-top: 100px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
  }
  
  /* Modal Content */
  .modal-content {
    position: relative;
    background-color: #fefefe;
    margin: auto;
    padding: 0;
    border: 1px solid #888;
    max-width: 40%;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
    -webkit-animation-name: animatetop;
    -webkit-animation-duration: 0.4s;
    animation-name: animatetop;
    animation-duration: 0.4s
  }
  
  /* Add Animation */
  @-webkit-keyframes animatetop {
    from {top:-300px; opacity:0} 
    to {top:0; opacity:1}
  }
  
  @keyframes animatetop {
    from {top:-300px; opacity:0}
    to {top:0; opacity:1}
  }
  
  /* The Close Button */
  .close {
    color: white;
    float: right;
    font-size: 28px;
    font-weight: bold;
  }
  
  .close:hover,
  .close:focus {
    color: $color5;
    text-decoration: none;
    cursor: pointer;
  }
  
  .modal-header {
    
    background-color: $color1;
    color: white;
    text-align: center;
  }
  
  .modal-header h2 {
      color: $color1;
      text-align: center;
  }
  
  .modal-body {
      padding: 2px 16px;
    }
  
    .modal-body h4 {
        font-family: $font1;
        font-weight: normal;
        color: $color4;
        font-size: 20px;
    }
  
  .modal-footer {
    padding: 2px 16px;
    color: white;
  }
  
  .modal-footer .btn {
      background-color: $color1;
      font-family: $font1;
      font-weight: normal;
      color: $color3;
  }
  
  .modal-footer .btn:hover{
      color: $color5;
  }
  </code></pre>