title: JavaScript: add extra attribute after new Option()
body: <p>I have a piece of code that dynamically adds options to a select field depending on some other criteria. It looks somewhat like this:</p>
  
  <pre><code>if (chosen == "a_value") {
    selbox.options[selbox.options.length] = new Option('text_1','value_1');
    selbox.options[selbox.options.length] = new Option('text_2','value_2');
    selbox.options[selbox.options.length] = new Option('text_3','value_3');
  }
  </code></pre>
  
  <p>What I need is to add an extra attribute to that new option that contains a specific value. In this case the attribute will be called "discount" and the value will be an integer. Later on I'll read the attribute values and process them based on the value in the Option field.</p>
  
  <p>So an option will look like this, once the script is ready;</p>
  
  <pre><code>&lt;option value="value_1" discount="integer"&gt;text_1&lt;/option&gt;
  </code></pre>
  
  <p>Makes sense?</p>
  
  <p>Now how can I do this without the use of JS frameworks. It's just this small part of code that I need, so a framework would be overkill for this project.</p>
  
  <p>Cheers! :-)</p>