O'Reilly logo

JavaScript by Example by Dani Akash S

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Click to copy text

Currently, this is how the info area looks:

For the click to copy feature, if you hover the mouse over the room URL, it should show a Copy button:

If you click the Copy button, it should copy the text and turn into the Copied button:

For this functionality, we need to add some event listeners. So, inside your home class, create a new method addEventListeners() and call it inside the constructor:

class Home { constructor() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required