It is necessary that when you select the string value in select , a text field string below, when the image selection is a file field.
html :
<label>Choose type</label> <select name="type" id="type"> <option></option> <option value="string">String</option> <option value="image">Image</option> </select> <div id="string" style="display:none;"> <input type="text"> </div> <div id="image" style="display:none;"> <input type="file"> </div> js
$('#type').on('change',function(){ var selection = $(this).val(); switch(selection){ case "string": $("#string").show() break; case "image": $("#image").show() break; default: $("#string").hide() } }); So that the bottom field does not display when nothing is selected, I write the function hide() . But there it turns out to score only one value. That is, the string is removed, but the image remains.
Question: how to add 2 values to hide() , or redo the code in js ? In js it is not strong, I found an example, I need it for the yii framework.
That's when string is selected.
But when I select image, then string sells well, either. Confusedly wrote, but I hope it is clear 


нужно для yii фреймворка=) And so - no one bothers to remove the extra label - Alexey Shimansky