Hello everyone,
I’m totally new in meteor.
I made this tutorial : http://meteortips.com, it was great.
However, I’m struggling at the start of my first project for a very simple thing and I don’t see answer on the web about that.
Here is my HTML :
<head>
<title>Stormchess</title>
</head>
<body>
<h1> Chessboard </h1>
{{> chessboard}}
</body>
<template name="chessboard">
<div id="chessboard">
<!-- … -->
<img class="square" src="images/blacksquare.png" alt="Black Square" />
<!-- … -->
</div>
</template>
The thing is, I want to put attribute draggable to false to all my img tags ; so, I start like I’d do without meteor.
Here is my client main.js :
import { Template } from 'meteor/templating';
import './main.html';
var squares = document.querySelectorAll(".square");
for(var i=0; i<squares.length; i++){
squares[i].draggable = "false";
}
And this simple thing doesn’t work. So i try to troubleshoot ==>;
var squares = document.querySelectorAll(".square");
console.log(squares);
In console, i’ve a null, which is my problem but i don’t understand why.
Even stranger : if i do :
var squares = document.querySelectorAll("body");
console.log(squares);
In this case, the console display me the body and all that’s within, my img tags included !!!
But if i try querySelector(".square"), or querySelector(“img”), or even querySelector(“h1”), the console display null. -_-’’’
I guess (and hope) the answer is simple but I can’t figure out my mistake and I’m blocked since hours on this … so I post here.