<script type="text/javascript" >
function switch_question_content_by_question_type(question_type){
$('.question_content').hide()
if(question_type == 'question_type_1'){
div_to_show ='question_content_of_question_with_numbers'
}else if (question_type == 'question_type_2'){
div_to_show ='question_content_of_question_with_options'
}else{
div_to_show ='question_content_of_question_with_text'
}
$('#'+div_to_show).show()
}
</script>
<select size="1" name="category_field_type" id="category_field_type" onChange="javascript:switch_question_content_by_question_type('question_type_'+this.value)")">
<option value="1" >数值</option>
<option value="2" >分类</option>
<option value="3" >文本</option>
</select>
<div class="question_content" id="question_content_of_question_with_numbers" style="display:block">
<h>单位</h></br>
<input type="text" value="<%= @category_id_project.unit %>" name="category[unit]" placeholder="请输入数值单位">
</div>
<!-------------------------------选择分类-------------------------------------->
<div class="question_content" id="question_content_of_question_with_options" style="display:none">
<br><input type="text" value="<%= @answer_list.answer1 %>" name="answer_list[answer1]" placeholder="请输入分类名"></br>
<br><input type="text" value="<%= @answer_list.answer2 %>" name="answer_list[answer2]" placeholder="请输入分类名"></br>
<br><input type="text" value="<%= @answer_list.answer3 %>" name="answer_list[answer3]" placeholder="请输入分类名"></br>
<br><input type="text" value="<%= @answer_list.answer4 %>" name="answer_list[answer4]" placeholder="请输入分类名"></br>
<br><input type="text" value="<%= @answer_list.answer5 %>" name="answer_list[answer5]" placeholder="请输入分类名"></br>
</div>
<!-------------------------------选择文本-------------------------------------->
<div class="question_content" id="question_content_of_question_with_text" style="display:none">
</div>
<script>
jQuery(document).ready(function(){
switch_question_content_by_question_type('question_type_'+ $('#category_field_type').val())
})
</script>
function switch_question_content_by_question_type(question_type){
$('.question_content').hide()
if(question_type == 'question_type_1'){
div_to_show ='question_content_of_question_with_numbers'
}else if (question_type == 'question_type_2'){
div_to_show ='question_content_of_question_with_options'
}else{
div_to_show ='question_content_of_question_with_text'
}
$('#'+div_to_show).show()
}
</script>
<select size="1" name="category_field_type" id="category_field_type" onChange="javascript:switch_question_content_by_question_type('question_type_'+this.value)")">
<option value="1" >数值</option>
<option value="2" >分类</option>
<option value="3" >文本</option>
</select>
<div class="question_content" id="question_content_of_question_with_numbers" style="display:block">
<h>单位</h></br>
<input type="text" value="<%= @category_id_project.unit %>" name="category[unit]" placeholder="请输入数值单位">
</div>
<!-------------------------------选择分类-------------------------------------->
<div class="question_content" id="question_content_of_question_with_options" style="display:none">
<br><input type="text" value="<%= @answer_list.answer1 %>" name="answer_list[answer1]" placeholder="请输入分类名"></br>
<br><input type="text" value="<%= @answer_list.answer2 %>" name="answer_list[answer2]" placeholder="请输入分类名"></br>
<br><input type="text" value="<%= @answer_list.answer3 %>" name="answer_list[answer3]" placeholder="请输入分类名"></br>
<br><input type="text" value="<%= @answer_list.answer4 %>" name="answer_list[answer4]" placeholder="请输入分类名"></br>
<br><input type="text" value="<%= @answer_list.answer5 %>" name="answer_list[answer5]" placeholder="请输入分类名"></br>
</div>
<!-------------------------------选择文本-------------------------------------->
<div class="question_content" id="question_content_of_question_with_text" style="display:none">
</div>
<script>
jQuery(document).ready(function(){
switch_question_content_by_question_type('question_type_'+ $('#category_field_type').val())
})
</script>