Hello Everyone ,
I have a problem with my price calculator when i've tryed to add options
( Js fiddle here = http://jsfiddle.net/wemdragon/hXydV/ )
What i'm trying to do is where it says:
var firstoption=$('select#myselect')
i would like the options value turned into a price value like : option value (Which is 1 ) = 20.00 but can't seem to do it.
If anyone could nicely help me and tell me what i'm doing wrong with this, i'l really appreciate it.
You should probably give the <option>
the values you want, then just use:
var firstOption = +$('select#myselect').val();
jQuery val()
grabs the selected value, and the +
converts the string value (like "20"
) to a numeric.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.