next option jquery -
trying select next option drop down list using id identifier, no avail
here code
$('#chapter option:selected', 'select').removeattr('selected').next('option').attr('selected', 'selected')
i assume #chapter
<select>
or 1 of ancestors.
if that's case, remove context argument.
$('#chapter option:selected').removeattr('selected') .next('option').attr('selected', 'selected');
the way had it, doing this:
$('select').find('#chapter option:selected').removeattr(...
...which looking element inside <select>
has option:selected
descending elelent chapter
id.
edit: answer focused merely on why selection wasn't working. better accomplish ultimate task using method in @andy e's answer.
i'd recommend 1 accepted answer.
Comments
Post a Comment