我有下面的代码:使用Javascript - 在点击处理忽略/跳过
$(document).on('click','#tab-personal',function(e){
loadit('personal');
});
和
$("#tab-personal").click(function()
{
});
,当我:
$(document).ready(function(){
var rebuild = getParameterByName("rebuild");
var createdStructures = $('#AtoZContentDiv').children().length;
if ((rebuild !== undefined && rebuild !== null && rebuild.indexOf("true") === 0) || (createdStructures === 0))
{
// clean up pre-existing data
cleanUp();
// create container structure
createFormLinkContainers();
// Call SP web services to retrieve the information and create the A to Z
retrieveListData();
completeInitialization();
}
else
{
aggregateAll = jQuery.parseJSON($('#hdnAggregateAll').val());
aggregatePersonal = jQuery.parseJSON($('#hdnAggregatePersonal').val());
aggregateBusiness = jQuery.parseJSON($('#hdnAggregateBusiness').val());
ministryAggregate = jQuery.parseJSON($('#hdnMinistryAggregate').val());
caAggregate = jQuery.parseJSON($('#hdnCAAggregate').val());
sTaxAggregate = jQuery.parseJSON($('#hdnSTaxAggregate').val());
bTaxAggregate = jQuery.parseJSON($('#hdnBTaxAggregate').val());
leTaxAggregate = jQuery.parseJSON($('#hdnLETaxAggregate').val());
var type = getParameterByName("filter");
$("#tab-all").click(function()
{
loadit('all');
});
$("#tab-business").click(function()
{
loadit('business');
});
$("#tab-personal").click(function()
{
});
$(document).on('click','#tab-personal',function(e){
loadit('personal');
});
buildFilterMenu();
loadit('all');
}
});
我一直在使用这两种尝试在他们中间放置一个断点,没有一个被击中。
HTML:
<div id="tabs" style="display: inline-block;">
<ul><li><a class="selected" id="tab-all" href="#" type="all"><b>All Forms</b></a></li>
<li><a id="tab-business" href="#" type="business"><b>Business</b> </a></li>
<li><a id="tab-personal" href="#" type="personal"><b>Personal</b> </a></li></ul>
</div>
全码:http://pastebin.com/vzLPX3cU
这究竟是为什么?
你尝试执行添加听众在控制台?试试这个:$(“#tab-personal”).on(“click”,function(){console.log(“click!”); }); – Sabik
我在Chrome的开发人员工具调试器中放置了一个断点。我曾尝试把一个console.log('<<<<个人'),但代码没有被击中。 – Brian
与你的例子DOM作品https://jsfiddle.net/k06w4mos/。也许你有一些错误,你的代码不能完全执行? – Sabik