转换“document.getElementById”直接进入 jQuery
我正在使用 qq.uploader 类,这是我的代码的一部分:
function createUploader(elementId){
var uploader = new qq.FileUploader({
element: document.getElementById(elementId),
onComplete: function(id, fileName, responseJSON){
if (responseJSON.success) {
$("#"+elementId + ".qq-upload-button").remove();
}
}
});
}
您可以看到行 $("#"+elementId + ".qq-upload-button").remove();
行不起作用,但希望您能看到我正在尝试做什么。我的页面上有多个上传者,因此我需要单独定位特定的上传者,而不仅仅是班级。
(我刚刚还意识到该插件创建了一组 #id,它将在整个页面中重复。所以我也很好奇优秀的 jquery 文件上传插件,这些插件可以很好地处理每个页面的多个实例,每个实例只上传一个文件?)
I'm using the qq.uploader class and here is a portion of my code:
function createUploader(elementId){
var uploader = new qq.FileUploader({
element: document.getElementById(elementId),
onComplete: function(id, fileName, responseJSON){
if (responseJSON.success) {
$("#"+elementId + ".qq-upload-button").remove();
}
}
});
}
You can see the line $("#"+elementId + ".qq-upload-button").remove();
is not going to work, but hopefully you can see what I'm trying to do. I have multiple uploaders on the page so I need to target specific ones separately instead of just the class.
(I just also realized the plugin creates a set #id which will be repeated throughout the page.. so I'm also curious about good jquery file upload plugins that work well with multiple instances per page with only one file uploaded per instance?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)