How it works…

The way this works is similar to other plugins used in this chapter. As we can see in step 4, when the document ready event fires, we target the HTML element with an ID of example, and then we call the barrating() method on it. We pass an object to this method, and in this case, we give it a key-value pair of theme: 'fontawesome-stars'. This will override the default behavior of the barrating() plugin. It is a simple way to allow us as plugin users to customize the plugin behavior. For a detailed explanation of how this works, check out the second recipe in Chapter 7, Make Your Own jQuery Plugins in Bootstrap 4.

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.