开发者

Convert “document.getElementById” directly into 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").r开发者_开发知识库emove();
            }
        }
    });
}

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?)


var id = '#' + elementId +'.qq-upload-button';
if (responseJSON.success) {
      $(id).remove();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜