我需要使用 jquery 来禁用选定行中的链接。我的代码在下面我能够禁用其他两个元素但由于某种原因我无法禁用看起来已禁用的链接但我仍然可以单击它而且它只禁用第一行中的链接我只想禁用选定的行链接。
jQuery
function groupVerificationHandler(){
$('#labelNbrFromSummary').val(labelNbrs);
$('#loadDateFromSummary').val(loadDates);
$('#typeFromSummary').val(typeFromSummary);
//check if no check box is checked-+
if(labelNbrs == ''){
alert('You must select at least one Label!');
return false;
}
//disable the check boxes
$('input[name=summaryCheckbox]:checkbox').each(function(){
$(this).attr('disabled', true);
});
//diable select button
$('#groupVerification').attr('disabled', true);
//disable the link
$('#label').attr('disabled', true);
$('#verification').load('/analysis/loadVerification',
$('#formForSummary').serialize());
// $('#verification').load(url, function(){});
$('#verification').show();
}
形式
<th class="cb"><input type="button" id="groupVerification" name="selectCheckBox" value="Select">
</th>
<td id="label" bgcolor='<c:out value="${summary.color}"></c:out>'><a
href="/analysis/loadAnalysisDetail?labelNbr=${summary.labelNbr}&loadDate=${summary.loadDate}"><c:out
value="${summary.labelNbr}" /> </a>
<td align='center' bgcolor='<c:out value="${summary.color}"></c:out>'>
<input name='summaryCheckbox' type="checkbox" class="cbx"
value='<c:out value="${summary.labelNbr}"></c:out>,<c:out value="${summary.loadDate}"></c:out>,<c:out value="${summary.eventInd}"></c:out>'>
启用jQuery:
function enableSelectHandler(){
var message = "You have chosen to cancel this update and will be returned to the summary screen. \n\nDo you want to continue?";
var answer = confirm(message);
if(answer){
$('#verification').hide();
//disable the check boxes
$('input[name=summaryCheckbox]:checkbox').each(function(){
$(this).attr('disabled', false);
});
//diable select button
$('#groupVerification').attr('disabled', false);
// enable the link
$('#label').attr('disabled', false);
//need to check if it is the first load for summary
if($('#labelNbrFromSummary').val() != '') //Not first time
labelNbrs = $('#labelNbrFromSummary').val();
//alert(labelNbrs);
if($('#loadDateFromSummary').val() != '')
loadDates = $('#loadDateFromSummary').val();
//alert(loadDates);
if($('#typeFromSummary').val() != '')
typeFromSummary = $('#typeFromSummary').val();
//alert(typeFromSummary);
}else{
return false;
}
}