Hi,
I am a newbie in using jquery.Please excuse me if similar query has been posted earlier.
I building pagination using jquery.
links are like displayed like
First | Previous | 1 - 15 | Next | Last
If i click on Next link, it will build the whole listing like
some relevant parts of my code is
$(function()
{
$('#nextlink').bind('click',loadmaillist)
$('#prevlink').bind('click',loadmaillist)
$('#lastlink').bind('click',loadmaillist)
$('#firstlink').bind('click',loadmaillist)
});//ft
function loadmaillist()
{
clickedlink = $(this).text();
if(clickedlink == 'Previous')
{
startcount=Number(temp)-Number(msgcount);
}
else if(clickedlink == ‘Next’)
{
startcount=Number(temp)+Number(msgcount);
}
else if(clickedlink == ‘First’)
{
startcount=0;
}
else if(clickedlink == ‘Last’)
{
startcount=lastcount;
}
maillist_html_tag =
‘<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 width=100%><TR BGCOLOR=#D2D2D2><!—New Mail—><td width=23 height=32 align=center><table width=23 cellpadding=0 cellspacing=0 border=0><tr><td></td></tr></table></td><!—New Mail—><!—Attachment Pin—><td width=23 align=center><table width=23 cellpadding=0 cellspacing=0 border=0><tr><td></td></tr></table></td><!—Attachment Pin—><td width=23><table width=23 cellpadding=0 cellspacing=0 border=0><tr><td></td></tr></table></td><!—From/To—>’;
if (SrtFld == 1 && SrtOrd == 1)
{
maillist_html_tag += '<td width=30% class=addrtop><TABLE cellSpacing=0 cellPadding=0 width=100% border=0><TR><TD height=5></TD></TR><TR><TD class=sb1> <a folder='+folder+'>';
if (folder == "Drafts" || folder == "Sent_messages")
{
maillist_html_tag += 'To';
}
else
{
maillist_html_tag += langfrom;
}
maillist_html_tag += ‘</a></TD><TD align=right><img ></TD></TR></TABLE></td>’;
}
.
.
.
.
.
//Display ‘First,Previous’
if (startcount == 0)
{
nextprevfirst1_html_tag = First+' | '+Previous;
$('#nextprevfirst1').html(nextprevfirst1_html_tag);
}
else
{
nextprevfirst1_html_tag = '<a >'+First+'</a> ';
nextprevprev1_html_tag = '<a >'+Previous+'</a>';
$('#nextprevfirst1').html(nextprevfirst1_html_tag);
$('#nextprevprev1').html(nextprevprev1_html_tag);
}
//Display ‘1-15’
if(mailend != 0)
{
nextprevmid1_html_tag = mailstart+' - '+mailend;
}
else
{
nextprevmid1_html_tag += '0';
}
$(’#nextprevmid1’).html(nextprevmid1_html_tag);
//Display ‘Next,Last’
if (mailend == mailcount)
{
nextprevnext1_html_tag = langnext;
nextprevlast1_html_tag = langlast;
$('#nextprevnext1').html(nextprevnext1_html_tag);
$('#nextprevlast1').html(nextprevlast1_html_tag);
}
nextprev_html_tag += ‘ </font></font>’;
$(’#jquery_maillist_div’).html(maillist_html_tag);
}
here the links have been added on the fly.href of all links has been set to [removed]void(0); in order to avoid loading new page.Problem is when any link is clicked, nothing happens and the function is not called.And no error is thrown on js console
Regards
Rupam
[Mod edit: moved to HTML, CSS, and Design forum]