我正在尝试自定义一些操作系统 jQuery 来创建一个 div,然后在其中添加另一个“createElement”,以便我可以使用 css 进行样式设置。我在这里超出了我的深度,任何帮助都会很棒。这是我的代码:
container = $(doc.createElement(options.containerTagName)).attr({
id: namespace + '-' + element.attr('id'),
'class': options.containerClassName
}).insertAfter(element);
$(doc.createElement('span'))
.appendTo(container)
.append(element);
uploadwrapper = $(doc.createElement('div'))
.attr('class', 'btn_upload_wrapper')
.insertAfter(container);
$(doc.createElement('input'))
.attr(options.buttonAttributes)
.attr('type', 'button')
.appendTo(uploadwrapper);
$(doc.createElement('i'))
.attr('class', 'icon-folder-open')
.appendTo(uploadwrapper);
textElement = $(doc.createElement(options.textTagName))
.attr(options.textAttributes)
.appendTo(uploadwrapper);
我能够回答我自己的问题,见下文
container = $(doc.createElement(options.containerTagName)).attr({
id: namespace + '-' + element.attr('id'),
'class': options.containerClassName
}).insertAfter(element);
$(doc.createElement('span'))
.appendTo(container)
.append(element);
$(doc.createElement('div'))
.attr('class', 'btn_upload_wrapper')
.appendTo(container);
$(doc.createElement('input'))
.attr(options.buttonAttributes)
.attr('type', 'button')
.appendTo('.btn_upload_wrapper');
$(doc.createElement('i'))
.attr('class', 'icon-folder-open')
.appendTo('.btn_upload_wrapper');
textElement = $(doc.createElement(options.textTagName))
.attr(options.textAttributes)
.appendTo('.btn_upload_wrapper');