insertAdjacentHTML();

CodePen showing different positionings of insertAdjacentHTML

Like so many others, a lot of my 2017 extracurricular coding has been focussed around learning more JavaScript. Last week, I refactored Holy Guacamole! to utilize vanilla JavaScript instead of jQuery.

I originally built it in 2015 and revisiting my code was one of those startling, “Oh-goodness-look-at-all-these-cobwebs-WHY-would-I-put-that-THERE?!” moments. One of the super helpful translation moments was learning more about insertAdjacentHTML();.

I then may or may not have gotten a little carried away with creating a CodePen to show off the different positions you can pass it as arguments.

[codepen_embed height=”1100″ theme_id=”0″ slug_hash=”dRrdgN” default_tab=”result” user=”allisonplus”]See the Pen <a href=’https://codepen.io/allisonplus/pen/dRrdgN/’>insertAdjacentHTML + r2 droid</a> by Allison Tarr (<a href=’https://codepen.io/allisonplus’>@allisonplus</a>) on <a href=’https://codepen.io’>CodePen</a>.[/codepen_embed]

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *