I'm trying to create a button that can select next option.
So, i have a select (id=selectionChamp) with several options, an input next (id=fieldNext), and i try to do that :
$('#fieldNext').click(function() {
$('#selectionChamp option:selected', 'select').removeAttr('selected')
.next('option').attr('selected', 'selected');
alert($('#selectionChamp option:selected').val());
});
But I can not select the next option.. Thanks !
$('#fieldNext').click(function() {
$('#selectionChamp option:selected').next().attr('selected', 'selected');
alert($('#selectionChamp').val());
});
Better answer by @VisioN: https://stackoverflow.com/a/11556661/1533609