How to get the id of selected option in datalist : <p>I know the method to get the id while the value in option is unique but my case is different</p>

<pre><code>&lt;select id="product-list"&gt;
   &lt;option value="Product" id="1"&gt;
   &lt;option value="Product1" id="2"&gt;
   &lt;option value="Product1" id="3"&gt;
   &lt;option value="Product2" id="4"&gt;
&lt;/select&gt;
</code></pre>

<p>Options are dynamically generated from database depending on the search query typed in input field.
There are situations when multiple products come with same name but other different properties like rate or unit.
So in order to solve the issue i want get the id of the selected option </p>
