- This topic is empty.
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Paginating using jQuery
Suppose i have a html code like this.
<div class="question">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>20</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
<div>18</div>
<div>19</div>
<div>20</div>
<div>21</div>
.......................up to 100
</div>
<button class="next">Next</button>
What i want to do ?
When someone click next button i want to add new button previous , hide 1,2,3,4,5
show 6,7,8,9,10
.And again if someone click button it hide 6,7,8,9,10
and show 11,12,13,14,15
and i want to hide next button when 95,96,97,98,99,100
is shown .
I could do up to here
`<script>
$(function(){
var question=$(“.question div”);
question.addClass(‘hide’);
$(“.next”).on(“click”,function{
$(“<button></button>”,{class=”previous”,text=”previous”}).insertBefore(‘.next’);
$(“question div:lt(11)”).show();
$(“question div:lt(6)”).hide();
return false;
});
});
</script>
`
Is it possible using jquery ? thanks :)