It seems you want to select the next sibling .question current .question.selected element. You can use the .nextAll() and .first() methods for this:
$('.selected').removeClass('selected') .hide() .nextAll('.question') .first() .show() .addClass('selected');
And to update the value of the previous input sibling with the className element with a click, you can use the .prev() and .val() methods.
$('.selected')... .addClass('selected') .prev('input') .val($(this).hasClass('nu') ? 'no' : 'yes');
source share