title: Get innerHtml of an created element by Javascript
body: <p>I created an element by</p>
  
  <pre><code>a = document.createElement("DIV");
  a.setAttribute("class", "select-selected");
  a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;
  x[i].appendChild(a);
  </code></pre>
  
  <p>and when i try to get innerHtml of the Class <code>select-selected</code> it returns "undefined"</p>
  
  <p>The goal is to switch between Select Option depending the first Choice.</p>
  
  <p><a href="https://codepen.io/KarimKha/pen/EqEqao" rel="nofollow noreferrer">Here's the code on CodeOpen</a></p>
  
  <p>Thanks to the community of StackOverflow. </p>