Reputation: 3
I have some HTML like this:
<div class="col-xs-3 col-sm-3 col-md-3 no-padding--xs" style="text-align:right; padding-left:30rem">
<div class="no-padding--xs box--lang">
<a href="Intranet_sk.html"><img style="width:30px" src="Intranet_flags/flag-SVK-round.png"></a>
<a href="Intranet_en.html"><img style="width:30px"src="Intranet_flags/flag-UK-round.png"></a>
</div>
</div>
</div>
and I want to keep it in the upper part of page layout but use it in the lower part of the (rendered) page, a bit like if you store the code in a variable and use the variable in specific part of the page.
The whole Intranet will be made of many modules but this one will be unique for every "subpage" so I want to keep the editable code in the upper part of the page layout and call/publish it using a lower static module.
Why? the "Intranet_
" in href part will be unique for every subpage.
Alternatively, could I attach "_sk
" or "_en
" to the subpage metaname and create the link like that?
Upvotes: 0
Views: 76
Reputation: 122956
document.createElement
) [createdElement].appendChild([someElement].cloneNode([true]))
) [createdElement].querySelector[All](...)
)Essential here: the created element only exists in memory (is not inserted/appended in the DOM).
Upvotes: 0
Reputation: 170
You can store html code in a normal string and add it to any html element by doing element.innerHTML += stringThatContainsHTML
You can also retrieve HTML in the same way var htmlString = element.innerHTML
Upvotes: 1