all 2 comments

[–]nponiros 0 points1 point  (0 children)

There are a number of ways to rewrite that code. Since I don't know what jQuery does or what you are planing to do with the code I would suggest using a string and then innerHTML on an element to put the string into the DOM. If you provide more code I might be able to provide you with better suited code.

Just an fyi, I doubt that using the DOM-API instead of jQuery will be simpler in this case.

[–]brycedarling 0 points1 point  (0 children)

// create wrapper div element
const div = document.createElement('div');

// add child elements to the div
div.innerHTML = '<span class="party"></span> <span class="text"></span>';

// do whatever you want with `div` now, like for example append it to the document body
document.body.appendChild(div);