显示基于下拉选择的字段集yii 2

I am new to javacripting and Yii2 Framework. Can anyone please help me just to display a set of field values depending on the dropdown selection.

For example, I have in dropdown "If you are a student or not?":

  • Yes
  • No

If user selects Yes then display a div containing other fields to be answered.

I could find answers regarding doing it in general but specifically using Yii 2 I am having problems.

Thank you in advance.

This is very simple with jquery... and there's a couple ways you can do it, but here's an example:

//HTML
<input type="radio" name="student" id="studentY" /> Yes
<input type="radio" name="student" id="studentN" /> No

<div id="moreQuestions">
    <p>This is your block containing more fields</p>
</div>

//JS
$('#studentY').click(function(){
    $('#moreQuestions').show();
});

$('#studentN').click(function(){
    $('#moreQuestions').hide();
});

http://jsfiddle.net/95fvgcnn/