javascript - How to get the current value of attribute -
i have table gets data database, each column contains button gives review of particular row in modal box, modal box contains next , previous button, next gives details of next row of table , previous give previous data of row. question is:
i able next , previous once?
$('#review_essay').delegate('.navbtn', 'click', function () { var current_row_id = $(this).parents('#review_essay').attr('current_row_id'); var position_value = $(this).attr('position_value'); var navvalue = parseint(current_row_id) + parseint(position_value); alert(current_row_id) alert(position_value) alert(navvalue) var qid = $('#essay_data').find('tbody').find('tr').eq(navvalue - 1).attr('qid'); alert(qid); var uid = $('#essay_data').find('tbody').find('tr').eq(navvalue - 1).attr('uid'); var paper_id = $('#essay_data').find('tbody').find('tr').eq(navvalue - 1).data('paper_id') var session_id = $('#exam_details').attr('session_id') var exam_id = $('#exam_details').attr('exam_id') //alert('reached'); navigate(exam_id, session_id, paper_id, qid, uid); });
it not performs more once. current_row_id
remain 0
.
the 1 problem i'm seeing not updating current_row_id
update navvalue
$('#review_essay').delegate('.navbtn', 'click', function () { var current_row_id = $(this).parents('#review_essay').attr('current_row_id'); var position_value = $(this).attr('position_value'); var navvalue = parseint(current_row_id) + parseint(position_value); alert(current_row_id) alert(position_value) alert(navvalue) var qid = $('#essay_data').find('tbody').find('tr').eq(navvalue - 1).attr('qid'); alert(qid); var uid = $('#essay_data').find('tbody').find('tr').eq(navvalue - 1).attr('uid'); var paper_id = $('#essay_data').find('tbody').find('tr').eq(navvalue - 1).data('paper_id') var session_id = $('#exam_details').attr('session_id') var exam_id = $('#exam_details').attr('exam_id') //alert('reached'); navigate(exam_id, session_id, paper_id, qid, uid); //update current_row_id new value $(this).parents('#review_essay').attr('current_row_id', navvalue); });
Comments
Post a Comment