add tag at specific div index

Posted by stackover on Stack Overflow See other posts from Stack Overflow or by stackover
Published on 2011-01-04T23:47:44Z Indexed on 2011/01/04 23:54 UTC
Read the original article Hit count: 112

Filed under:
|

var element = document.getElementById("divname");

var pagerHtml ='<a href="#" class="prev">&lt Prev</a>';

for (var page = 1; page <= this.pages; page++){

`pagerHtml += '<a href="#" class="'+ page> + page + '</a>  ';`  

}

pagerHtml += '<a class="dotline" style="display:none;">........</a>

pagerHtml += '<a href="#" class="next"> Next &gt;</a>'; element.innerHTML = pagerHtml;

if(this.pages > 9){

`for(var i=this.buffer;i<(this.pages-this.buffer);i++){`  
     `("."+i+1)).hide();`

}

} I want to add class "dotline" so that when pages are hidden I would do $(".dash").show(); and it would look like 1,2,.....,8,9,10. any ideas would be appreciated.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html