Question

I am trying to customized some OS jQuery to create a div and then add the other "createElement" inside so that I can style with css. I'm out of my depth here and any help would be great. Here is my whack at the code:

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

I was able to answer my own question, see below

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');
Was it helpful?

Solution

Was able to answer my own question. Please close this question

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');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top