惯例:
我是温浩然:
chrome浏览器报错
Uncaught TypeError: ((n.event.special[g.origType] || (intermediate value)).handle || g.handler).apply is not a function
我这个错误,与这个错误并不一样
http://blog.csdn.net/a15937822658/article/details/12841643
页面代码如下:
<ul class="nav" id="side-menu" > <li><a href="/forum/pc/mycircle">我的关注</a></li> <li><a href="#"><span class="nav-label">其他版块</span><span class="fa arrow"></span> </a> <ul class="nav nav-second-level"> <c:forEach items="${boardType}" var="boardTypeList" varStatus="status"> <li> <a class="otherBoardList" data-boardType-id="${boardTypeList.id}" href="#">${boardTypeList.name}</a> </li> </c:forEach> </ul> </li> <li><a href="javascript:void(0);" id="myjoin">wodecanyu</a></li> <li><a href="/forum/pc/info/1">个人信息</a></li> <li><a href="#">● ● ●</a></li> <li><a href="/forum/pc/superm">下面是管理员权限</a></li> <li><a href="/forum/pc/doctor">人员管理</a></li> <li><a href="#"><span class="nav-label">帖子管理</span><span class="fa arrow"></span> </a> <ul class="nav nav-second-level"> <c:forEach items="${boardType}" var="boardTypeList" varStatus="status"> <li> <a class="allBoardList" data-boardType-id="${boardTypeList.id}" href="#">${boardTypeList.name}</a> </li> </c:forEach> </ul> </li> <li><a href="#">● ● ●</a></li> <li><a href="/forum/pc/superm">下面是超级管理员权限</a></li> <!-- <li><a href="/forum/machh/list">妇幼保健院管理</a></li> --> <li><a href="<spring:url value='/pboardType/show'/>">版块类别管理</a></li> <li><a href="#"><span class="nav-label">版块管理</span><span class="fa arrow"></span> </a> <ul class="nav nav-second-level"> <c:forEach items="${boardType}" var="boardTypeList" varStatus="status"> <li> <a class="boardList" data-boardType-id="${boardTypeList.id}" href="#">${boardTypeList.name}</a><!-- href="<spring:url value='/pboard/show/${boardTypeList.id}'/>" --> </li> </c:forEach> </ul> </li> </ul>
然后,JS代码如下:
var INDEX = { init:function(el){ INDEX.buidEevnt(); }, buidEevnt:function(){ $('#side-menu').on('click','#myattention',INDEX.myAttention); $('#side-menu').on('click','#postManager',INDEX.postManager); $('#side-menu').on('click','.otherBoardList',INDEX.showOtherBoardList); $('#side-menu').on('click','.allBoardList',INDEX.showallBoardList); $('#side-menu').on('click','.boardList',INDEX.showallBoardListManager); }, //我的关注 myAttention:function(){ $.postJson(cp+'/pcir/del',function(result){ $('#wrapper').html(result); }); }, //版块类别管理 postManager:function(){ $.postJson(cp+'/pcir/del',function(result){ $('#wrapper').html(result); }); }, //其他版块列表 otherBoardList:function(){ var el=$(this); alert(el.attr('data-boardtype-id')); $.get(cp+'/post/showbtn/'+el.attr('data-boardtype-id'),function(result){ alert(result); $('#wrapper').html(result); }); }, //帖子管理界面 allBoardList:function(){ var el=$(this); $.get(cp+'/post/showbtn/'+el.attr('data-boardType-id'),function(result){ alert(result); $('#wrapper').html(result); }); }, //板块管理界面 allBoardListManager:function(){ var el=$(this); $.get(cp+'/pboard/show/'+el.attr('data-boardType-id'),function(result){ alert(result); $('#wrapper').html(result); }); } } INDEX.init();
错误原因,上面方法名与下面的方法名不一致导致的错误。
$('#side-menu').on('click','.otherBoardList',INDEX.showOtherBoardList);
//其他版块列表 otherBoardList:function(){ var el=$(this); alert(el.attr('data-boardtype-id')); $.get(cp+'/post/showbtn/'+el.attr('data-boardtype-id'),function(result){ alert(result); $('#wrapper').html(result); }); },
时间: 2024-10-31 17:49:52