我的代码完全正常。如果我使用此代码func createFolderWith(Name: String!) {
let folderRequest: AWSS3PutObjectRequest = AWSS3PutObjectRequest()
folderRequest.key = Name + "/"
folderRequest.bucket = "Your Bucket Name"
AWSS3.defaultS3().putObject(folderRequest).continueWithBlock({ (task) -> AnyObject? in
if task.error != nil {
assertionFailure("* * * error: \(task.error?.localizedDescription)")
} else {
print("created \(Name) folder")
}
return nil
})
}
和if ($(e.target).is("#checkId_ i"))
,则会在正文中跳过if ($(e.target).is("[id^=checkId_] i"))
语句。我只是看到了我朋友的整个代码,但我问他,他也不知道是什么原因。
以下代码的工作原理是什么,我的测试代码不是?。
数据表
if
Body OnClick
columns:
[
{ data: "testID", title: "Test Click Button", searchable: false, orderable: false, sClass: "alignCenter",
"mRender": function (data) {
return '<button type="button" class="btn btn-info btn-xs action" id="checkId_' + data + '"><i class="fa fa-dollar fa-fw action"></i></button>'
+ ' <button type="button" class="btn btn-danger btn-xs action" id="checkId2_' + data + '"><i class="fa fa-dollar fa-fw action"></i></button>';
}
}
]
答案 0 :(得分:0)
我建议你使用最接近的:
$('#tbltest tbody').on('click', 'tr', function (e) {
e.preventDefault();
if ($(e.target).closest("[id^=checkId_]").length) {
alert("Button 1 is Click");
} else if ($(e.target).closest("[id^=checkId2_]").length) {
alert("Button 2 is Click");
}
});