joexn joexn - 1 year ago 72
HTML Question

Use custom tag using JavaScript only

On my site, as a little footer I guess, I use the tag

<joexn id="yo">

and the javascript

var div = document.getElementById('yo');
div.insertAdjacentHTML( 'beforeBegin', '' );

This produces a watermark/footer and want I want to know is how can I change it so the tag is just
using Javascript only. I want minimalist code only and no clutter. I tried using
but that didn't work.

What's the easiest method?

Answer Source

try using document.querySelector(): DEMO

var div = document.querySelector('joexn');
div.insertAdjacentHTML( 'beforeBegin', '' );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download