我有一个简单的问题,我试图在页面加载时禁用 jQuery 按钮
<body>
<div id="inDetialContainer" style="display:none;">
<div id="detailText">Detailed Information</div>
<button id="overviewDiv" class="nesteIndtText" href="#" onClick="loadInnerOfChildPage(1);">Overview</button> // this button should be disabled when data does not exist
<button id="proceduresDiv" class="nesteIndtText" href="#" onClick="loadInnerOfChildPage(2);">Procedures</button> // this button should be disabled when data does not exist
<button id="equipmentDiv" class="nesteIndtText" href="#" onClick="loadInnerOfChildPage(3);">Equipment</button> // this button should be disabled when data does not exist
<button id="backgroundDiv" class="nesteIndtText" href="#" onClick="loadInnerOfChildPage(4);">Background</button> // this button should be disabled when data does not exist
<button id="safetyDiv" class="nesteIndtText" href="#" onClick="loadInnerOfChildPage(5);">Safety</button> // this button should be disabled when data does not exist
<button id="examQuestionsDiv" class="nesteIndtText" href="#" onClick="loadInnerOfChildPage(6);">Exam Questions</button> // this button should be disabled when data does not exist
</div>
<div id="subContent3" style="display:none;">
<div id="normalTextHeader">Equipment Details</div>
<p class="noData">Content not available.</p>
</div>
<script>
$(document).ready(function()
{
parent.parent.loadInnerOfChildPage = loadInner;
function loadInner(arg)
{
var flag = false;
var parentId;
flag = ( $("#subContent"+arg).children('p').hasClass('noData'));
if(flag == false)
{
$("#subContent"+arg).css("display","block");
$("#subContent"+arg).siblings(this).css("display","none");
$("#backToNav").css("display","block");
}
else
{
parent.parent.$("#inDetialContainer button #").parent().attr("disabled","disabled");
$("#subContent"+arg).css("display","none");
$("#subContent"+arg).siblings(this).css("display","none");
$("#backToNav").css("display","none");
}
}
});
</script>
加载页面时,如果数据不存在,则应在文档就绪时禁用单击。谁能解释这怎么可能?
谢谢!