分页 Link 无法点击 JQuery
Pagination Link Not Clickable with JQuery
我在 Razor 页面上有以下代码,应该在单击 link 时调用 JS 函数,但没有任何反应。好像残疾了有人可以帮忙吗?下面是代码:
Razor 页面上的代码:
@for(var pge = Model.StartPage; pge <= Model.EndPage; pge++)
{
<li class="page-item @(pge == Model.CurrentPage ? "active" : "")">
<a id="@("#plink" + pge)" class="rpt_btn_lnk page-link pglink"
data-action="@ViewData["ActionName"]"
data-pg="@pge"
data-pageSize="@ViewData["PageSize"]"
data-category="@ViewData["CategoryId"]"
data-categoryAction="@ViewData["CategoryAction"]"
data-currentSearchFilter="@TempData["CurrentSearchFilter"]">
@pge
</a>
</li>
}
JQuery:
$(function () {
$(".rpt_btn_lnk").click(function () {
var pageSize = $(this).attr('data-pageSize');
var pg = $(this).attr('data-pg');
var category = $(this).attr('data-category');
var categoryAction = $(this).attr('data-categoryAction');
var currentSearchFilter = $(this).attr('data-currentSearchFilter');
var action = $(this).attr('data-action');
$("#partialRptList").load("/Report/" + action + "?id=" + id + "&pg=" + pg + "&category=" + category + "&categoryAction=" + categoryAction
+ "¤tSearchFilter=" + currentSearchFilter + "&pageSize=" + pageSize);
});
});
不知道分页是否DOM加载?
尝试用 $(document).on('click', '.rpt_btn_lnk', function(){
替换 $(".rpt_btn_lnk").click(function () {
我在 Razor 页面上有以下代码,应该在单击 link 时调用 JS 函数,但没有任何反应。好像残疾了有人可以帮忙吗?下面是代码:
Razor 页面上的代码:
@for(var pge = Model.StartPage; pge <= Model.EndPage; pge++)
{
<li class="page-item @(pge == Model.CurrentPage ? "active" : "")">
<a id="@("#plink" + pge)" class="rpt_btn_lnk page-link pglink"
data-action="@ViewData["ActionName"]"
data-pg="@pge"
data-pageSize="@ViewData["PageSize"]"
data-category="@ViewData["CategoryId"]"
data-categoryAction="@ViewData["CategoryAction"]"
data-currentSearchFilter="@TempData["CurrentSearchFilter"]">
@pge
</a>
</li>
}
JQuery:
$(function () {
$(".rpt_btn_lnk").click(function () {
var pageSize = $(this).attr('data-pageSize');
var pg = $(this).attr('data-pg');
var category = $(this).attr('data-category');
var categoryAction = $(this).attr('data-categoryAction');
var currentSearchFilter = $(this).attr('data-currentSearchFilter');
var action = $(this).attr('data-action');
$("#partialRptList").load("/Report/" + action + "?id=" + id + "&pg=" + pg + "&category=" + category + "&categoryAction=" + categoryAction
+ "¤tSearchFilter=" + currentSearchFilter + "&pageSize=" + pageSize);
});
});
不知道分页是否DOM加载?
尝试用 $(document).on('click', '.rpt_btn_lnk', function(){
$(".rpt_btn_lnk").click(function () {