I write about front-end web development. I'm inspired by Nathan Barry's motto,
teach everything you know. I also take a lot of inspiration from my friend and mentor, Chris Ferdinandi.
Search my blog
You probably know you can use the
innerHTML property to update an element’s HTML content. But did you know you can use the
outerHTML property to replace an element entirely?
In jQuery, you can use the
outerHeight() methods to get an element’s total width and height including its padding and borders. You can easily do the same thing in vanilla JS with support back to IE9.
In jQuery, there are two methods you can use to get an element’s children. The
contents() method will get all child nodes including comment and text nodes. The
children() method will only get children that are HTML elements. Here’s how to do this in vanilla JS with browser support back to IE9.