为了加快应用程序的速度,我尝试使用委托功能而不是点击功能......但由于某些原因,我什至无法进入该功能......
有什么帮助吗??
这是代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/checkbox.css"/>
<link rel="stylesheet" href="css/jquery.mobile-1.1.1.css" />
<title>Subscribe</title>
<script src="scripts/jquery-1.8.2.min.js"></script>
<script src="scripts/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
**Want to use Delegate instead of Click**
$('#selectAllTechAreas').click(function(){
//alert('aaa');
$('.techAreasCheckBox').attr('checked', true);
}); // Tech Areas Select All click function
$('#selectAllAssetTypes').tap(function(event){
$('.assetTypeCheckBox').attr('checked', true);
}); // Asset Types Select All click function
$('#clearAllSelections').click(function(){
$('.assetTypeCheckBox').attr('checked', false);
$('.techAreasCheckBox').attr('checked', false);
});
}); // document
</script>
</head>
<body>
<div data-role="content" class="contentGrayBg">
<div id="categoriesTable">
</table>
<br>
<div class="container">
<div class="floatLeft">
<table id="technologyAreas">
<tr>
<td>
<fieldset id="techAreasCB" data-role="controlgroup">
<legend style="font-style: bold; font-size:16px">Technology Areas:</legend>
<table>
<tr>
<td><input type="checkbox" data-mini="true" name="checkbox1" id="checkbox1" class="case techAreasCheckBox" /></td>
<td style="padding-left: 40px">SAP</td>
</tr>
<tr>
<td><input type="checkbox" data-mini="true" name="checkbox2" id="checkbox2" class="case techAreasCheckBox" /></td>
<td style="padding-left: 40px">Oracle</td>
</tr>
<tr>
<td><!-- <input type="checkbox" id="selectAllTechAreas"/> --></td>
<td > <label id="selectAllTechAreas" style="color: orange; padding-left: 10px"><b>Select All</b></label></td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</div> <!-- Div Class Float Left -->
</div>
</div>
</div>
</body>
</html>
谢谢,安基特。