Make a JavaScript library like jQuery

Have you ever wondered how to make a JavaScript Library?

If you’ve ever used jQuery you’ll appreciate how simple it is to pick up and use, it’s full of easy to remember functions which are way more convenient than remembering the vanilla JavaScript version.

Before we start writing our own library, let’s first look at some vanilla JavaScript versions of what we use in jQuery

Continue reading

jQuery: Make all external links open in a new window

It’s easy to forget to add that target=”_blank” each time, and even more difficult to remind clients to select that option in your WYSIWYG!

In a lot of websites I develop we use jQuery – and one of the things I place at the bottom of every website is a snippet to add target=”_blank” to every external link tag.

The jQuery/JavaScript

  return this.hostname && this.hostname !== location.hostname;

© 2019 Chubby Ninja

Theme by Anders NorenUp ↑