Firstly I have gone through some questions having same title as mine like this etc. but none solved my problem.
HTML part -
<tr id="row_question_container">
<td valign="top" colspan="2">
<div id="at_test_area-1" class="at_test_area">
<div id="at_questions_container">
<div id="1" class="question_block completed unmarked" style="display: none;">
<!-- Question / Option / Settings etc in nested tables are here -->
</div>
<div id="2" class="question_block completed marked">
<!-- Question / Option / Settings etc in nested tables are here -->
</div>
<div id="3" class="question_block incomplete unmarked" style="display: none">
<!-- Question / Option / Settings etc in nested tables are here -->
</div>
<div id="4" class="question_block incomplete unmarked" style="display: none">
<!-- Question / Option / Settings etc in nested tables are here -->
</div>
</div>
</div>
</td>
</tr>
What I am trying to achieve is to get next/closet id
of div
(to navigate using next and previous buttons) having class incomplete
or marked
. After reading through similar questions, I tried following jQuery, but it returned undefined
var marked_question = $('#at_questions_container').next('.marked').attr('id');
alert(marked_question);