french_dev
french_dev

Reputation: 2177

Uncaught TypeError: Cannot read property 'addEventListener' of null chrome-extension

For a few hours when I debug my application on my browser I have this error appears:

Uncaught TypeError: Cannot read property 'addEventListener' of null chrome-extension://fommidcneendjonelhhhkmoekeicedej/scripts/optionsToggle.js

I open the link in a new tab in order to have the optionToggle.js code, wich is:

// Javascript for welcome page buttons
function showFirstTime() {
    $('#firstTimeSection').toggle('slow');
    $('#updatesSection').hide();
}
function showUpdate() {
    $('#updatesSection').toggle('slow');
    $('#firstTimeSection').hide();
}

document.getElementById('firstTimeBtn').addEventListener('click',showFirstTime);
document.getElementById('oldTimerBtn').addEventListener('click',showUpdate);

The line where the error occured is the penultimate line:

document.getElementById('firstTimeBtn').addEventListener('click',showFirstTime);

The only thing I made today is to update the chrome version.

Someone know what this error really means and how to solve her?

Thank You in advance.

Upvotes: 3

Views: 9904

Answers (2)

Arm1stice
Arm1stice

Reputation: 101

The real error here is that you are trying to add an event listener to a DOM object that doesn't exist on the page, which is why the error states you can't set that property on null.

Upvotes: 0

Edwin Reynoso
Edwin Reynoso

Reputation: 1531

Well it's an extension, you have an extension that is running that script. Go to chrome:extensions in your browser, turn on developer mode and match the id: fommidcneendjonelhhhkmoekeicedej

Upvotes: 2

Related Questions