title: What is the difference between HTML Event Attributes and Assign Events Using the HTML DOM?
body: <p>HTML Event Attributes:</p>
  
  <pre><code>&lt;button onclick="displayDate()"&gt;Try it&lt;/button&gt;
  </code></pre>
  
  <p>Assign Events Using the HTML DOM:</p>
  
  <pre><code>&lt;script&gt;
  
  document.getElementById("myBtn").onclick = function(){ displayDate() };
  
  &lt;/script&gt;
  </code></pre>
  
  <p>What is the difference between these two ? Any advantages in using (Assign Events Using the HTML DOM) ?</p>
  
  <p>Thanks</p>