question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'querySelectorAll' of null

See original GitHub issue

It’s really strange, chartist was working fine for me a few days ago but suddenly nothing works.
I copy pasted most of the below code from the official website, so I don’t think the error is on my part, but I can’t be sure.
I’m getting the same error on all browsers, on both minified and unminified versions of chartist, and on both npm and CDN versions of chartist.

index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Data Chart</title>
  <link rel="stylesheet" href="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.css">
  <script src="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.js"></script>
  <script src="chart.js"></script>
</head>
<body>
  <div class="ct-chart ct-perfect-fourth"></div>
</body>
</html>

chart.js

var data = {
  // A labels array that can contain any sort of values
  labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
  // Our series array that contains series objects or in this case series data arrays
  series: [
    [5, 2, 4, 2, 0]
  ]
};

// Create a new line chart object where as first parameter we pass in a selector
// that is resolving to our chart container element. The Second parameter
// is the actual data object. As a third parameter we pass in our custom options.
new Chartist.Bar('.ct-chart', data);

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
prashcrcommented, Dec 27, 2015

My bad, the script tags were supposed to be at the end of body, not in head.

1reaction
hot-Whiskeycommented, May 5, 2017

I had a really dumb error that caused this error message. The div I was trying to change into a graph I had as div id=“#all_results” which obviously should have been div id=“all_results”. Moral of the story, check to make sure you have things named properly, etc because it’ll trigger this message.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'querySelector' of null - Stack Overflow
I am using Cordova app in Visual Studio 2015. I have added a simple button which changes the color of background of app...
Read more >
Cannot read property 'querySelectorAll' of null - Laracasts
Uncaught TypeError : Cannot read property 'querySelectorAll' of null. Hi there, I am getting an error in my jQuery code and I don't...
Read more >
Cannot read property 'querySelector' of null -- No idea why
What this is telling you is that there is no 'querySelector' method on a null object. The object that it is trying to...
Read more >
Uncaught type error: cannot read property 'queryselector' of null
Solution would be validating for null values before accessing the functions in it. but you will only have to trace the code to...
Read more >
Cannot read property 'querySelectorAll' of null - OutSystems
i just update my app to OutsystemsUI 2.3.0 and after the update when i open the Menu Block i got the this error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found