在laravel中,我需要一些帮助,我是laravel的新手,当选择该选项时,如果任何一个这是代码,请检查
<select name="question_type_id" class="div-toggle" data-target=".my-info-1">
<option value="" disabled selected>Choose Question Type</option>
@foreach($question_type as $questy)
<option value="{{$questy->id}}">{{$questy->question_type_name}}</option>
@endforeach
</select>
这是数据库结构,用于存储图像链接中的选项,请检查http://mrshineonline.com/images/database.png用于更改的div是
<div class="1 box">
here multiple choice options
</div>
<div class="2 box">
Here fill in the blank options
</div>
这是jquery。你也可以用香草js来做,但你没有提供任何信息
<select name="question_type_id" class="div-toggle" data-target=".my-info-1">
<option value="" disabled selected>Choose Question Type</option>
@foreach($question_type as $questy)
<option value="{{$questy->id}}" >{{$questy->question_type_name}}</option>
@endforeach
</select>
@foreach($question_type as $questy)
<div class="toggles-{{ $questy->id }}" class="hidden">
...
</div>
@endforeach
<script>
(function() {
var els = $("div[class^='toggles-']");
$('.div-toggle').change(function(event) {
els.hide();
$('.toggles-' + event.target.value).show();
});
})();
</script>