views:

58

answers:

1

I've got the following jQuery code for getting the first character of the string value of the selected option of an html select box.

var mode = $("#mode :selected").text()[0];

"mode" is the id of the html select element I want. This is not working in IE at the moment - does anyone know why that might be?

EDIT: Sorry everyone, it was nothing to do with jQuery. IE just wanted

var mode = $("#mode :selected").text().charAt(0);

I'm not sure why I thought the [0] would work in the first place. Thanks anyway.

A: 

maybe the problem is with not specifying the 'option'

we use this code in serveral of our projects and this does work in IE

$("#ComboBox option:selected").text()
Sander