check at least one checkbox is checked and if yes then increase count
iam working with a online quiz application.
i displayed the questions and its 4 options in the screen.
@foreach($assessments->assessmentsubdetails as $question)
<div class="border-dash" id="questions{{ $loop->iteration }}">
//question description
<h5>{{ strip_tags($question->questiondetails->ques_desc) }}</h5>
//checkbox A name="stud_answer1[]"
<div class="relative-check-box">
<input type="checkbox" name="stud_answer{{ $loop->iteration }}[]" id="A" value="A">
<div>A</div>
</div>
<p class="option">{{ strip_tags($question->questiondetails->option_a) }}</p>
//checkbox B name="stud_answer1[]"
<div class="relative-check-box">
<input type="checkbox" name="stud_answer{{ $loop->iteration }}[]" id="B" value="B">
<div>B</div>
</div>
<p class="option">{{ strip_tags($question->questiondetails->option_b) }}</p>
//checkbox C name="stud_answer1[]"
<div class="relative-check-box">
<input type="checkbox" name="stud_answer{{ $loop->iteration }}[]" id="C" value="C">
<div>C</div>
</div>
<p class="option">{{ strip_tags($question->questiondetails->option_c) }}</p>
//checkbox D name="stud_answer1[]"
<div class="relative-check-box">
<input type="checkbox" name="stud_answer{{ $loop->iteration }}[]" id="D" value="D">
<div>D</div>
</div>
<p class="option">{{ strip_tags($question->questiondetails->option_d) }}</p>
</div>
@endforeach
i have displayed the question and 4 options (4 options are checkbox). how i named is
i framed a div tag for a whole single question
<div class="border-dash" id="questions{{ $loop->iteration }}">
so for a single question the id will be question1
when it goes to second question it will be question2and so on based on total questions
For check box how i framed is
name="stud_answer{{ $loop->iteration }}[]"
so for the 4 checkbox of first question it will be stud_answer1[]
so question 1 div id=questions1 --> its 4 checkbox name will be stud_answer1[]
question 2 div id=questions2 --> its 4 checkbox name will be stud_answer2[]
question 3 div id=questions3 --> its 4 checkbox name will be stud_answer3[]
. . . so on
now whats my problem is i need to mark attempted and not attempted in side palette. how to do this
if a student checked one checkbox for first question then it attempted must be count increased. but if the student check more than one option in the same question it should not be incremented. for single question only one checkbox then should be incremented.
attempted (0) not attempted (30)
if 1 question checked then attempted(1) not attempted(29)
Attempted (<label id="attempted" >0</label>)
Unattempted (<label id="unattempted" >1</label>)
and also the palette question number must change its color. the below is my question palette
<ul class="all-option">
@foreach($assessments->assessmentsubdetails as $question)
<li><a href="#questions{{ $loop->iteration }}" class="smoothScroll">{{$loop->iteration}}</a></li>
@endforeach
</ul>
i have a class name green when a check box from first question is checked the class name should become green. already here there is a class smoothscroll
Kindly some one help please
Please or to participate in this conversation.