最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin2浏览0评论

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 wele 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.

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 wele 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.

Share Improve this question asked Apr 7, 2015 at 13:57 french_devfrench_dev 2,17711 gold badges48 silver badges91 bronze badges 4
  • What is this a content Script or browser action/page action? – Edwin Reynoso Commented Apr 7, 2015 at 14:03
  • @Edwin It's not a content script of my web application that I am developped for the moment, I don't know where this script e from. It's the script the browser console give me, where the erro occured. – french_dev Commented Apr 7, 2015 at 14:06
  • 1 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 – Edwin Reynoso Commented Apr 7, 2015 at 14:15
  • @Edwin, you have the good answer. It's the Hacker Vision extension who gave me this error. Make an answer for my question to explain your ment, in order to put this issue as resolved. – french_dev Commented Apr 7, 2015 at 14:23
Add a ment  | 

2 Answers 2

Reset to default 3

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

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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论