Get name from option HTML with Javascript
<pre><code>&lt;option value="1" name="13.890000"&gt;Monster&lt;/option&gt;
</code></pre>

<p>I would like to get name via javascript to do calculations (On change) (NOTE: NOT VALUE)</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>$("#calculateprice").on('change', function() {
    x =  $(this).children(':selected').attr('name');
    z = x/1000;
});</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;select id="calculateprice" name="serviceid" class="form-control"&gt;
&lt;option selected disabled&gt;Select a monster&lt;/option&gt;
&lt;option value="1" name="13.890000"&gt;Monster 1&lt;/option&gt;
&lt;option value="2" name="25.890000"&gt;Monster 2&lt;/option&gt;                                
&lt;/select&gt;

&lt;input id="quantity" name="quantity" type="text" placeholder="" class="form-control input-md" required&gt;

&lt;input id="price" name="price" type="text" class="form-control input-md" disabled&gt;

   </code></pre>
</div>
</div>
</p>

<p>Now, I would like to get amount entered in QUANTITY and multiply with Z and show the result in PRICE.</p>

<p>SOLVED LIKE THIS:</p>

<pre><code>var z;
var totalprice;

$("#calculateprice").on('change', function() {
    x =  $(this).children(':selected').attr('name');
    z = x/1000;
});

$("#quantity").on('keyup', function() {
    value = $("#quantity").val();
    totalprice = z*value;
    totalresult = parseFloat(Math.round(totalprice * 100) / 100).toFixed(2);
    $('#price').val('$'+totalresult);
});
</code></pre>