Given that i have the following:
var el, main;
main = _.findWhere(this.widget.snippets, {
name: "main"
});
el = document.createElement("script");
el.setAttribute("data-require", value.name + "@*");
el.setAttribute("data-semver", a.semver);
el.setAttribute("src", a.scripts);
console.log(el + main.body);
/*
[object HTMLScriptElement]
<div bb-breadcrumb></div>
<div bb-content></div>
*/
I am trying to append my newly created script to my body. However it keeps returning [object HTMLScriptElement] is there not a way that i convert this to a string which will then allow me to do the concatenation.
Further update:
The value of the var main is an object that looks like the following:
$$hashKey: "018"
body: "<div breadcrumb></div>↵<div content></div>↵"
file_extension: "html"
file_name: "main"
isEdited: false
name: "main"
So with this at hand. You will see that I create an <script></script> element for which outputs:
<script data-require="jquery@*" data-semver="2.1.1" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Now towards the end of the code sample I initially provided I want to concatenate that tag and append it to the main.body so the end output would look like:
<script data-require="jquery@*" data-semver="2.1.1" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div breadcrumb></div>
<divcontent></div>