I’m having an issue in IE 8 where I’m trying to store a value from a form field select box using jQuery’s val(). The String shows up fine in all browsers except IE 7/8 where it shows up as null. I’m assuming it has to do with the characters (quotes?) in the field, but I’m not sure how to work around this. Code below:
var $size = $("#size");
var size = $size.find('option:selected').val(),
The actual value of the selected field is:
L: 158.375" x 80.5" 4023mm x 2045mm
Thanks in advance for any help.
Assuming that
#sizeis the id of the select box, why are you usingfind('option:selected')? Whatever the currently selected option is will be theval()of the select element.e.g.
$('select#size').val();should return the value of the selected option.