I have a page where my tag in paginatethis is used to paginate all the fields. Now from my php script 2 to 100 paginatethis class=abc tags can be generated , How can I get the values of only the current field? I have Used A Plugin For Pagination easyPagination hence im using the paginatethis tag
My Pagination code looks like this
$('#qwe').easyPaginate({
paginateElement: 'paginatethis.abc',
elementsPerPage: 1,
effect: 'climb'
});
This is my jQuery. I need to select all elements in the current paginatethis tag on button click.
$(document).ready(function() {
$(".submit:current").click(function(){
var quesid = $("#quesId").val();
var oans = $("#oans").val();
var cdate = $("#testDate").val();
var studans = $("#answer:checked").val();
$.ajax({
url: "<?php echo base_url('Front/submitAns');?>",
data: {
quesid: quesid,
oans: oans,
cdate: cdate,
studans: studans
},
method: "POST",
dataType: "text",
success: function(data) {
$("#counts").html(data);
}
});
});
});
<paginatethis class="abc">
<input type="radio" value="A" class="form-group" id="answer" name="answer">
<input type="radio" value="B" class="form-group" id="answer" name="answer">
<input type="radio" value="C" class="form-group" id="answer" name="answer">
<input type="radio" value="D" class="form-group" id="answer" name="answer">
<input type="hidden" name="testDate" value="<?php echo date("Y-m-d");?>" >
<input type="hidden" name="oans" id="oans" value="<?php echo base64_encode($data->ans);?>" >
<input type="hidden" name="quesId" id="quesId" value="<?php echo $data->id;?>" >
<button type="button" name="submit" class="submit">SUBMIT</button>
</paginatethis> <!--/value changed from above tag-->
<paginatethis class="abc">
<input type="radio" value="A" class="form-group" id="answer" name="answer">
<input type="radio" value="B" class="form-group" id="answer" name="answer">
<input type="radio" value="C" class="form-group" id="answer" name="answer">
<input type="radio" value="D" class="form-group" id="answer" name="answer">
<input type="hidden" name="testDate" value="<?php echo date("Y-m-d");?>" > //value changes in every tag
<input type="hidden" name="oans" id="oans" value="<?php echo base64_encode($data->ans);?>" >
<input type="hidden" name="quesId" id="quesId" value="<?php echo $data->id;?>" >
<button type="button" name="submit" class="submit">SUBMIT</button>
</paginatethis>