你能帮助将以下Javascript转换成jQuery等价吗?
// Let's use a lowercase function name to keep with JavaScript conventions
function selectAll(involker) {
// Since ASP.NET checkboxes are really HTML input elements
// let's get all the inputs
var inputElements = document.getElementsByTagName('input');
for (var i = 0; i < inputElements.length; i++) {
var myElement = inputElements[i];
// Filter through the input types looking for checkboxes
if (myElement.type === "checkbox") {
// Use the involker (our calling element) as the reference
// for our checkbox status
myElement.checked = involker.checked;
}
}
}
Run Code Online (Sandbox Code Playgroud)
它是从这里http://wiki.asp.net/page.aspx/281/check-uncheck-checkboxes-in-gridview-using-javascript/
function selectAll(involker) {
$('input:checkbox').attr('checked', $(involker).attr('checked'));
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
262 次 |
| 最近记录: |