Avoiding collisions with our components

Until now we've only used the Tooltip JavaScript component so our code is solid. However, in the next section, we will introduce a different component called Popovers. We need to do some clean up of our JavaScript code so that the two don't collide with each other and give us unwanted results.

Since this is the case, we should go back to _layout.ejs and edit the code by providing a specific ID for each Tooltip that you want to use in your project. Our script should now look like this:

<script> 
  $("#tooltip-link").tooltip(); 
  $("#tooltip-button").tooltip(); 
</script> 

Note

Note that I removed the a and button selectors and replaced them with IDs named #tooltip-link and #tooltip-button. Now we also need to update ...

Get Bootstrap 4 – Responsive Web Design 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.