How would one go about pulling out just a number in the text of an element? I want to set this as a variable.
ie. If I wanted to have a variable made from option val 171 of the number 12 so I can do calculations with it (I just want to be left with the number 12):
<select id="coloroption"> <option value="172">Granite Gray</option> <option value="174">Hot Red</option> <option value="173">Navy</option> <option value="171">Kentucky Green (min. 12)</option> </select>
var number = $('#coloroption option[value="171"]').text().match(/\d+/);
Live demo. Depending on the possible values of this option and what you need to extract from it, the regex might need tweaking.