title: How to create data-list for multiple input fields on the form? HTML5
body: <p>I have form with about 50 fields that should have same options for user to select. I was looking over datalist in HTML5. Looks pretty good because gives the option to user to type in desired option from the list. I was wondering if there is an option to apply same data list to all 50 fields. Only examples that I found so far use <code>id</code> attribute. Is there a way to create this with JQuery/Javascript and apply the same class to all fields? I have tried but didn't work, my input fields are empty and no error in the console. Here is my example: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function () {
       for(var i=0; i &lt;= 120; i+=5){
        $('#hzIntervals').append("&lt;option value='" + i + "'&gt;");
       }
   });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input type="text" list="hzIntervals" size="3" /&gt;
  &lt;datalist id="hzIntervals" style="width:20px;"&gt;&lt;/datalist&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Above code will produce datalist with an option only for one field. Also I set width on datalist but still I see more width once I click on my input field. I would like datalist width to match input field width (size=2). If anyone knows how to achieve that please let me know. Also I'm open for any suggestions.</p>