Question: Please advise me why I can't create this example in my home html file?

Here is an example from the [site](http://jsfiddle.net/eM2Mg/) and my html file:

```
<head>
<script src="http://dygraphs.com/dygraph-dev.js"></script>
<script>
g = new Dygraph(document.getElementById("graph"),
                 "X,Y,Z\n" +
                 "1,0,3\n" +
                 "2,2,6\n" +
                 "8,14,3\n",
                 {
                     legend: 'always',
                     animatedZooms: true,
                     title: 'dygraphs chart template'
                 });          
</script>
<style>
.dygraph-title {
    color: gray;
}
</style>
</head>
<body>
<div id="graph"></div>
</body>

```

what am I doing wrong?

Answer: 
javascript script must be after div or you need to use document ready to load body first and then script

```
<html>
<head>
  <title></title>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://dygraphs.com/dygraph-dev.js"></script>
<style>
.dygraph-title {
    color: gray;
}
</style>
</head>
<body>
<div id="graph"></div>
<script>
g = new Dygraph(document.getElementById("graph"),
                 "X,Y,Z\n" +
                 "1,0,3\n" +
                 "2,2,6\n" +
                 "8,14,3\n",
                 {
                     legend: 'always',
                     animatedZooms: true,
                     title: 'dygraphs chart template'
                 });          
</script>
</body>
</html>

```
One main issue is that your code is running too early. You are trying to operate on DOM elements before they have even been loaded. Code running in the `<head>` section cannot yet access elements in the DOM because it has not yet been loaded.

You can move your second `<script>` tag to right before the `</body>` tag and that problem should go away.