Integrating a simple CSS Class Replacement plugin with Bootstrap 4

In this recipe, we will build on the concepts discussed in the preceding recipe. The plugin we make in this recipe will be used to help us showcase Flexbox layout options in the next chapter. For now, we will focus on making the plugin itself. The goal of the plugin is very simple--we want to have a plugin that we can pass two classes to. Then, in our HTML, we will add a button, and it will serve as a toggle. On clicking it, it will find the first css class and replace it with the second one. On another click, it will do the opposite.

Get Bootstrap 4 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.