Skip to content
Advertisement

How to get my button to work using javascript?

I am creating an Google chrome extension and I am trying to get my stop/stop logging button to work within my function named Logger. When the button is pressed it doesn’t react to the function I wrote, Currently it is displaying the stop-button but I want it to display the start-button when clicked. I hope I explained that to some understanding but do anyone possibly know why my function is not working?

Below is my current javascript function and html :

popup.js

JavaScript

popup.html

JavaScript

Image of current output–button currently doesnt react

Advertisement

Answer

This may help to get the core functionality working, this implementation can be much improved

JavaScript

You have to try to keep the queries to the DOM to a minimum. Have a look at the toggle method it will help to make your code a bit leaner and easier to maintain

Advertisement