iterate in all text and link inside of TD
by tridip
HTML
<table id='test' border=1><tr><td>hello....</td></tr>
<tfoot>
<tr class="webgrid-footer">
<td colspan="6">
1
<a href="mypage" >2</a>
<a href="mypage" >3</a>
<a href="mypage" >4</a>
<a href="mypage" >></a>
<a href="mypage" >>></a>
</td>
</tr>
</tfoot>
</table>
<div id='dv'>
</div>
CSS
/*Webgrid style start*/
.webgrid-table {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 1.2em;
width: 100%;
display: table;
border-collapse: separate;
border: solid 1px #98BF21;
background-color: white;
}
.webgrid-table td, th {
border: 1px solid #98BF21;
padding: 3px 7px 2px;
}
.webgrid-header {
background-color: #A7C942;
color: #FFFFFF;
padding-bottom: 4px;
padding-top: 5px;
text-align: left;
text-decoration: none;
}
.webgrid-header a:hover {
text-decoration: none;
}
.webgrid-footer
{}
.webgrid-footer td {
padding: 0px;
}
.webgrid-footer a:hover {
text-decoration: none;
}
.webgrid-row-style {
padding: 3px 7px 2px;
}
.webgrid-alternating-row {
background-color: #EAF2D3;
padding: 3px 7px 2px;
}
.notshow {
display: none;
}
.SmallCols {
width: 10%;
}
.NameColWidth {
width: 20%;
}
.footstuff {
background-color: White;
color: Red;
}
.footstuff a:visited {
color: Blue;
}
.footstuff a {
color: Blue;
}
.footstuff td {
background-color: White;
border-color: White;
}
/*Webgrid style start*/
#content {
background: #fff none repeat scroll 0 0;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
display: block;
/*padding: 25px 20px 35px;*/
width: 100%;
/*margin-top:30%;*/
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 62.5%;
line-height: 1;
}
#content ol, ul {
list-style: outside none none;
}
.paginate > li:last-child
{
right:50px;
position:absolute
}
/*.paginate > li:last-child
{
float:right !important;
right:50px;
}*/
.paginate { margin: 0; }
.paginate {
display: block;
font-size: 1.2em;
width: 100%;
position:relative;
}
.paginate.pag1 {
}
.paginate.pag1 li {
font-weight: bold;
}
.paginate.pag1 li a {
background:...
JavaScript
var $div = $('<div id="content" />');
var $list = $('<ul class="paginate pag5 clearfix" />');
var $item = $('<li class="single" />').append('Page 5 of 5 of 50');
$list.append($item);
var $elements = $('.webgrid-footer td').contents().filter(function() {
return (this.nodeType === 3 && $.trim(this.nodeValue) !== '')
|| this.nodeType === 1;
});
$elements.each(function(){
if($(this).html()===null)
{
alert('1st')
alert('cur '+$.trim($(this).text()));
$item = $('<li class="current" />').append($(this));
//alert(getOuterHtml($(this)));
}
else
{
alert('2nd')
alert($(this).text());
if(!isNaN(parseInt($(this).text())))
{
$item = $('<li />').append($(this));
}
else
{
$item = $('<li class="navpage"/>').append($(this));
//alert($(this).text());
}
}
$list.append($item);
});
$item = $('<li class="single" />').append('<div id="loader">Loading....</div>');
$list.append($item);
$div.append($list);
//alert($('.webgrid-footer td').html());
$('.webgrid-footer td').append($div);
//$div.append($list);
//$('#dv').append($list);