In my project I need to update a backbone model with both the selected value and text from a <select>
.
For this purpose I am calling
model.set 'value', $('select').val()
model.set 'value_text', $('select option:selected').text()
(I am using coffee script as well). Because of some problem in jQuery v2.0.3 which I am currently using I am receiving this warning:
Attr.specified is deprecated. Its value is always true.
I know there were questions on SO about this warning, but I want to ask something completely different:
Since updating to a newer version of jQuery (where the problem might be fixed) is not possible in next few months I would like to ask whether there is other way round to receive the selected option's text instead of that used above. I am not against pure JS solution if there is no other using jQuery.
Any help is highly appreciated.
EDIT for @KevinB: The warning is caused by asking whether there is selected
attribute on that option.